Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed regexp to find substring between two tokens
    text
    copied!<p>I suspect this has already been answered somewhere, but I can't find it, so...</p> <p>I need to extract a string from between two tokens in a larger string, in which the second token will probably appear again meaning... (pseudo code...)</p> <pre><code>myString = "A=abc;B=def_3%^123+-;C=123;" ; myB = getInnerString(myString, "B=", ";" ) ; method getInnerString(inStr, startToken, endToken){ return inStr.replace( EXPRESSION, "$1"); } </code></pre> <p>so, when I run this using expression "<code>.+B=(.+);.+</code>" I get "def_3%^123+-;C=123;" presumably because it just looks for the LAST instance of ';' in the string, rather than stopping at the first one it comes to.</p> <p>I've tried using (?=) in search of that first ';' but it gives me the same result.</p> <p>I can't seem to find a regExp reference that explains how one can specify the "NEXT" token rather than the one at the end.</p> <p>any and all help greatly appreciated.</p> <hr> <p>Similar question on SO:</p> <ul> <li><a href="https://stackoverflow.com/questions/1237/regex-to-pull-out-a-section-a-substing-from-a-string-between-two-tags">Regex: To pull out a sub-string between two tags in a string</a></li> <li><a href="https://stackoverflow.com/questions/328387/regex-to-replace-all-n-in-a-string-but-no-those-inside-code-code-tag">Regex to replace all \n in a String, but no those inside [code] [/code] tag</a></li> <li><a href="https://stackoverflow.com/questions/180793/replace-patterns-that-are-inside-delimiters-using-a-regular-expression-call">Replace patterns that are inside delimiters using a regular expression call</a></li> <li><a href="https://stackoverflow.com/questions/299942/regex-matching-html-tags-and-extracting-text">RegEx matching HTML tags and extracting text</a></li> </ul>
 

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