Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Compare two regex patterns

by linxdev (Sexton)
on Aug 27, 2014 at 01:31 UTC ( [id://1098692]=note: print w/replies, xml ) Need Help??


in reply to Compare two regex patterns

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1098692]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-20 16:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found