Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Regex question

by Anonymous Monk
on Sep 22, 2011 at 15:12 UTC ( [id://927391]=note: print w/replies, xml ) Need Help??


in reply to Regex question

Anyone got any suggestions?

:) Use a module already? ;)

This is what you have

use YAPE::Regex::Explain; print YAPE::Regex::Explain ->new( qr/\[(\/?)(lien|url|citation|img).+?\]/s )->explain; __END__ The regular expression: (?s-imx:\[(/?)(lien|url|citation|img).+?\]) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?s-imx: group, but do not capture (with . matching \n) (case-sensitive) (with ^ and $ matching normally) (matching whitespace and # normally): ---------------------------------------------------------------------- \[ '[' ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- /? '/' (optional (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- ( group and capture to \2: ---------------------------------------------------------------------- lien 'lien' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- url 'url' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- citation 'citation' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- img 'img' ---------------------------------------------------------------------- ) end of \2 ---------------------------------------------------------------------- .+? any character (1 or more times (matching the least amount possible)) ---------------------------------------------------------------------- \] ']' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------

What do you think is wrong with your regex?

Replies are listed 'Best First'.
Re^2: Regex question
by ultranerds (Hermit) on Sep 22, 2011 at 15:21 UTC
    Yeah, this part ;)
    .+? any character (1 or more times (matching the least amount possible))
    As I updated in the above thread - I changed it to .*? and it works perfectly :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-19 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found