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