Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Regexp

by mkmcconn (Chaplain)
on Jul 25, 2002 at 20:40 UTC ( [id://185332]=note: print w/replies, xml ) Need Help??


in reply to regexp problem using custom markup

You are matching, but you are not capturing. You need the parens around the match.

@colors = $new =~ m/(\[color=.*\])/gi;

mkmcconn
update also, read Death to Dot Star!

Replies are listed 'Best First'.
Re: Re: Regexp
by Anonymous Monk on Jul 25, 2002 at 21:24 UTC
    If there are no parentheses, it returns a list of all the matched strings, as if there were parentheses around the whole pattern. -- perlop / Regexp Quote-Like Operators

    -Anomo

      Thank you Anomo - you are right. Without the /g operator it will return '1'; but, it will capture just fine using the operator: something that frankly I have never used or noticed.
      Thanks again.
      mkmcconn

Log In?
Username:
Password:

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

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

    No recent polls found