in reply to The craziest RegExes you ever created
My craziest regex:
use re 'eval'; my $string = "abc"; my $length = length $string; my $regex = qr/(\G[$string]{0,$length}(?{print "# [$&][$'][$string]\n"}))/ x + 2; $string =~ $regex;
Bonus points if you can figure out why I wrote that. As a fun exercise, try to figure out what it does and how it does it.
Of course, this forking regular expression might top it. Since the regex engine is not re-entrant, if you need that power, you have to fork.
Cheers,
Ovid
New address of my CGI Course.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: The craziest RegExes you ever created
by demerphq (Chancellor) on Jul 03, 2006 at 13:08 UTC | |
by Ovid (Cardinal) on Jul 03, 2006 at 13:24 UTC | |
by demerphq (Chancellor) on Jul 03, 2006 at 14:09 UTC | |
by diotalevi (Canon) on Jul 04, 2006 at 03:55 UTC | |
by demerphq (Chancellor) on Jul 04, 2006 at 07:43 UTC | |
Re^2: The craziest RegExes you ever created
by Ieronim (Friar) on Jul 03, 2006 at 17:32 UTC | |
by Ovid (Cardinal) on Jul 04, 2006 at 13:14 UTC |
In Section
Meditations