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

In reply to RegexParser-0.01 by japhy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.