Search this blog

Saturday, 17 September 2011

Regular expressions: negative look behind

I'm pleased to report after much gymastics that the regular expression feature "regular look behind" works with the "Replace" operator.

So if you have an attribute containing

"mit seit nach bei gegenuber von zu aus"

and you want to replace everything except the word "von" with "bier" then the following regular expression will do it.

replace what - \w+\b(?<!\bvon)
replace by - bier

The result is

"bier bier bier bier bier von bier bier"

Prost! :)


  1. Replacing all words by beer, it looks like Oktober Fest, doesn't it ?