emacs - Cannot match string with optional whitespace using regex -
i'm trying match following strings:
/*virtual*/, /* virtual*/, /*virtual */ , /* virtual */
the regexp /\*\svirtual\s\*/ correctly matches version 2 spaces, replacing \s [\s]* not match of these strings... reading emacs regularexpression reference document on wiki have assumed should create regex matching specification. still bit new regular expressions, (and explanation why above faulty) welcome!
try re-builder. it's useful. , expression is
"/\\* ?virtual ?\\*/" or, if go s-,
"/\\*\\s-?virtual\\s-?\\*/" but note it's not space, whatever syntax defines whitespace. write mode designates words like whitespace, , regex match them.
Comments
Post a Comment