Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

regex checking

by Tomtom (Scribe)
on May 26, 2005 at 08:19 UTC ( [id://460560]=perlquestion: print w/replies, xml ) Need Help??

Tomtom has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone,

I have an array of strings, and for each string, I would like to match it with a regex.
I wondered if there was some kind of module or something, that could tell me, if the string doesn't match, the reason why it didn't match, and at what point ( was it just one character not matching, or was the string totally different, or ... ).

I hope my question was clear enough :)
Thanks for your answers

Tomtom

Replies are listed 'Best First'.
Re: regex checking
by Hena (Friar) on May 26, 2005 at 08:44 UTC
    Well by using use re "debug"; you will get info printed on how the regex tries to match something. It will print both successes and failures and can be quite lenghty. And something similar is this Yape-Regex-Explain module (haven't used myself).
      Thank you :)
      I'll take a look at this.
Re: regex checking
by Joost (Canon) on May 26, 2005 at 09:40 UTC
Re: regex checking
by blazar (Canon) on May 26, 2005 at 08:32 UTC
    I hope my question was clear enough :)
    Indeed it is clear enough. However I'm not sure it is well posed. More precisely, I'm far from being a regex expert, but I strongly doubt that for a generic regex there would be a unique way not to match a given string.
      In fact, that regex I'm applying on the strings in the array is a sort of filter, so I was wondering if there was a way to know why a string or another didn't match, and at which position in the string it didn't match.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found