I'm resurrecting this thread to see if there are any new ideas.
I'm in the same boat as the OP.
In my case users create 100s of regular expressions, but sometimes they create dupes. Here are two such dupes.
^S.*$[\r\n]
^SYS.*$[\r\n]
I'm trying to figure out a way to compare each regex created to see if there is a possible dupe.
Whey the
\r\n? I need it there for the Perl Expect module. The data we are matching against comes in slowly and without Expect will not wait till the \n for $.
Any idea on how to test this would be appreciated.
I've tried Regexp::Compare, Regexp::ERE, and the Regexp debugger.
[root@host]# perl -Mre=debug -e '/12/';
Compiling REx "12"
Final program:
1: EXACT <12> (3)
3: END (0)
anchored "12" at 0 (checking anchored isall) minlen 2
Freeing REx: "12"
[root@host]# perl -Mre=debug -e '/1+/';
Compiling REx "1+"
Final program:
1: PLUS (4)
2: EXACT <1> (0)
4: END (0)
anchored "1" at 0 (checking anchored) plus minlen 1
Freeing REx: "1+"
Chris
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.