Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: How will my regular expression match?

by dpavlin (Friar)
on Jul 11, 2004 at 00:09 UTC ( [id://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.


Replies are listed 'Best First'.
Re^2: How will my regular expression match?
by hv (Prior) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://373416]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-06-21 20:28 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.