Reversing regular expressions

Tuesday 16 September 2003This is 21 years old. Be careful.

Just when you thought regular expressions were powerful and confusing enough, comes Reversing regular expressions. The idea is that if a match is too hard to make going forward through the string, then reverse the string first, apply a reversed regex to it, and finally reverse the resulting match. Wow.

Update (thanks to Simon, who shows Python for the technique): I forgot to mention that this technique is called “sexeger” (“regexes” backwards, get it?), and here’s japhy’s authoritative treatise on the subject.

Comments

[gravatar]
* pop *

Oops, there goes my brain... ;-)

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.