good chemistry is complicated,
and a little bit messy -LW
In the Web and in different books everybody can find smth like "connon regex lists" containig dozens of reallife regular expressions simple enough to be understood by everybody.
Being quite simple, these regexes are generally used to solve routine problems every Perl programmer meet.
But there are some tasks, which require regular expressions of much more complexity.
I want to make a list of complicated (obfuscated, odd etc.) regular expressions used to solve diffucult real problems (and then i plan to make it availible online somewhere outside this thread :) ). I will be very obliged if you post here examples of your most interesting regexes combined with chunks of data they were intended to match against.
My own favourite (it is combined from two regexes, one of which is recursive):
Of course, i didn't type the second regex myself; it is generated by my substructure search engine for the Bacterial Carbohydrate Structure Database as a response to a usual request. That's why i used the word "created" instead of "wrote" in the title — some interesting regexes are never typed, but are used intensively :)
Sample data to match against:
I hope to see yor examples described in the way i described mine :)
Short list of the IMHO best ones i found in replies (ordered by time the comment was posted):
A simple grep -E regex aimed to determine cross-posts between certain newsgroups.
by !1 The regex (be stricter, this mix of regex and perl code ;)) in the heart of this short script finds all triangles for this quest and puts them all in the %x hash.
URL matching RegEx by abigail
This does only a subset of the possible URLs: I had to put it under <spoiler> because of its length :)
forking regular expression by Ovid As this is a complete Perl script (the forking regex standalone has no sense), i have put it under spoiler too.
An abridged (due to incredible size of the original) version of ikegami's generated regex to solve Sudoku puzzles:
The regexes become stranger and stranger :) Whose will be the next? ;)