Visual studio 2013 regex search : looking for all strings of the form "if (something > 0)" + variations -


i using visual studio 2013 , working quite big c++/c# library. in it, looking occurences of strings of form ifxpoxvarxsymxzeroxpc :

  • x string composed spaces (the empty caracter, 0 space, allowed)
  • po , pc either both empty or respectively equal ( , )
  • var (c++ or c# kosher) variable name
  • sym operator equal >, <, <= or >=
  • zero equal 0, 0. or 0.0

example of strings want catch :

if    avar  <=   0. if(anothervar>0) if yetanothervar>  0 if ( lastvar >= 0.0 ) 

etc...

i tried if \s*\(\s*\w+ > 0\.?\0?\s*\)\s*and if \s*\(\s*\w+\s*>\s*0\.?\0?\s*\)\s* without success remarked each time in results lists did not everything. btw stick visual studio 2013's regex.

ideally, find string po composed more 1 opening parenthesis, in omit pc, able find strings of form if (((x > 0) algebraic condition looked belongs combo of many "algebraic comparisions" or other comparisons.

here regex can leverage here:

(?m)^if\s*\(?\s*\w+\s*[<>]=?\s*0\.?0?\s*\)? 

see demo

note use of multiline mode forces ^ match beginning of line. if if not @ start of line, replace ^ \b.

enter image description here


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -