REGEX: Select everything NOT equal to a certain string -


this should straightforward. need regular expression selects not contain word.

so if have sentence: "there word in middle of sentence." , regular expression gets "middle", should select in sentence "middle".

is there easy way this?

thanks.

it not possible single regex match operation discontinuous.

you use 2 capturing groups:

(.*)middle(.*)

then concatenate contents of capturing groups 1 , 2 after match.

you may wish enable "dot matches newline" option in parser.
see example java's dotall, .net's singleline, perl's s, etc.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -