Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you aren't comfortable with Regular Expressions (and I'm assuming that you aren't), you can use this pseudo code:</p> <ol> <li><p>Split the string into words (separate by spaces)</p></li> <li><p>Scan the list of words, if it equals <code>[ERROR]</code> then skip all words up to the next word starting with <code>[</code> and ending with <code>]</code></p></li> <li><p>If the word starts with <code>[</code> and ends with <code>]</code> then add it to the output and all following words that don't start with a <code>[</code> and end with a <code>]</code>.</p> <pre><code>public static String FilterString(string value) { string[] lsWords = value.Split(' '); StringBuilder lsbBuilder = new StringBuilder(); bool lbIncluding = true; foreach(String lsWord in lsWords) { if (lsWord.StartsWith("[") &amp;&amp; lsWord.EndsWith("]")) lbIncluding = (lsWord != "[ERROR]"); if (lbIncluding) { if (lsbBuilder.Length &gt; 0) lsbBuilder.Append(' '); lsbBuilder.Append(lsWord); } } return lsbBuilder.ToString(); } </code></pre> <p>....</p> <pre><code>string a = "[ERROR] = any thing And [ID] &gt; 20 And [NAME] like Varun"; string b = "[AGE] &lt; 60 Or [ERROR] like Exception And [ID] &gt; 20 And [NAME] like Varun And [ERROR] = any thing "; string c = "[ID] &gt; 20 And`enter code here` [NAME] like Varun And [ERROR] = any thing"; a = FilterString(a); b = FilterString(b); c = FilterString(c); </code></pre></li> </ol> <p>here's the output:</p> <pre><code>[ID] &gt; 20 And [NAME] like Varun [AGE] &lt; 60 Or [ID] &gt; 20 And [NAME] like Varun And [ID] &gt; 20 And`enter code here` [NAME] like Varun And </code></pre> <p>This doesn't get rid of the ANDS / ORS and so forth, you will need to do that one your self, but this should give you a nice starting point.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload