Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Regexp

by mkmcconn (Chaplain)
on Jul 25, 2002 at 20:40 UTC ( #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? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2023-01-29 06:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?