Yay! It's available! It requires Perl 5.6.0! It's probably
buggy! The code is kinda ugly! It's not documented! It
doesn't support the word boundary anchors (
\b and
\B)!
It currently supports regex-to-string and regex-reversal
conversions. It handles backreferences (and nested backrefs)
quite nicely. I've not seen any bugs in it so far, in the
rigorous, totally NOT run-of-the-mill regexes I've run through
it.
If you're interested, please download the source at
my
web site. The module comes with two test suites. Both
will ask for a regex. Just give it the "meat" of the regex
-- that is, leave off the
m/ and
/ part.
Example Run
jeffp% perl string-test
Enter your regex below (keep it normalish).
(\w{5})-(\d{2,4})\.txt
regex is : '(\w{5})-(\d{2,4})\.txt'
matched by: 't1nif-19.txt'
jeffp% perl string-test
Enter your regex below (keep it normalish).
(\w{5})-(\d){3}-\1-\2
regex is : '(\w{5})-(\d){3}-\1-\2'
matched by: 'rqqxI-754-rqqxI-4'
jeffp% perl reverse-test
Enter your regex below (keep it normalish).
(\w{5})-(\d{2,4})\.txt
normal : '(\w{5})-(\d{2,4})\.txt'
reversed: 'txt\.(\d{2,4})-(\w{5})'
normal : '(\w{5})-(\d{2,4})\.txt'
matchfor: 'Fr4eD-978.txt'
matchrev: 'txt.3582-jEp9c'
matchfor: 'UMVGk-5838.txt'
jeffp% perl reverse-test
Enter your regex below (keep it normalish).
(\w{5})-(\d){3}-\1-\2
normal : '(\w{5})-(\d){3}-\1-\2'
reversed: '(\d)-(\w{5})-\1(?:\d){2}-\2'
normal : '(\w{5})-(?:\d){2}(\d)-\1-\2'
matchfor: '85F7g-464-85F7g-4'
matchrev: '3-n7s1h-349-n7s1h'
matchfor: 'rWwij-705-rWwij-5'
The 'matchfor' is a match for the normal regex, the 'matchrev'
is a match for the reversed (YES, REVERSED!) regex, and the
second 'matchfor' is a match of the reversed reversed regex
(which is an "optimized" version of the original regex).
Download it! Have fun! Make the sleep I've lost over this
project MEANINGFUL!
$_="goto+F.print+chop;\n=yhpaj";F1:eval