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 :
xstring composed spaces (the empty caracter, 0 space, allowed)po,pceither both empty or respectively equal(,)var(c++ or c# kosher) variable namesymoperator equal>,<,<=or>=zeroequal0,0.or0.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.

Comments
Post a Comment