regex - Need regexp to find substring between two tokens -


I suspect that it has been answered somewhere in the past, but I am not getting it, so .. .

I need to remove the string from between two tokens in a big string, in which the second token will probably mean again ... (pseudo code ...)

 < Code> myString = "one = abc, b = def_3% ^ 123 + -; c = 123;"; Myb = getInnerString (myString, "B =", ";"); Method getInnerString (inStr, starttooken, endToken) {intrtr in return (Exception, "$ 1"); }  

So, when I run it with expression ". + B = (. +). + " def_3% ^ 123 + -; = 123; "Probably because this is just ';' The last instance of the string appears, instead of stopping any one of that earlier.

I have tried to use (; =) before ''; 'But it gives me the same results.

I can not find a regExp reference that explains how someone can finally specify "Next" token instead of one.

> Any and everyone is highly appreciated.


A similar question:

  • < / Li>

You're using greedy patterns by not specifying ? Try this in:

  ". + B = (. +?)." " 

Comments