Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: How will my regular expression match?

by dpavlin (Friar)
on Jul 11, 2004 at 00:09 UTC ( #373416=note: print w/ replies, xml ) Need Help??

in reply to How will my regular expression match?

Allthough, this is repetitive, using one-liners like:

perl -e "use re 'debug'; print 'this is a demo' =~ /\w+/;"
helped me more than once (it's even more useful with complex regexes :-). It'a a shame that you have to dig into perldebug to find it. I think it should be mentioned in perlre also.


Comment on Re: How will my regular expression match?
Download Code
Replies are listed 'Best First'.
Re^2: How will my regular expression match?
by hv (Parson) on Jul 11, 2004 at 03:13 UTC

    I use this a lot, usually with the shorter command-line invocation ('-Dr', available if perl was built with debugging enabled). However the output was designed primarily for internals debugging, and is likely to be more scary than helpful to the casual user.

    Various people have taken advantage of the information it provides to offer a friendlier interface to regexp debugging. Though I haven't tried any of them, I'm aware of ReBug (I believe this is open source, but I can't get to the website: the author gave a talk on it at the 2001 OSCON), Komodo (commercial, with "try before you buy"), and The Regex Coach ("donationware", donate if you like it) which was recently mentioned on PM.


Re^2: How will my regular expression match?
by diotalevi (Canon) on Jul 11, 2004 at 04:00 UTC
    There's also the shorter, perl -Mre=debug -e ' ... ' for those people without a debugging perl.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2015-10-09 16:33 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (245 votes), past polls