Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: regex on a line

by CukiMnstr (Deacon)
on Aug 01, 2002 at 16:18 UTC ( #186822=note: print w/replies, xml ) Need Help??


in reply to regex on a line

hm. let's see: i don't think you need the non-backreferencing parentheses around 'Update Status'. also, when you are looking for $view, you get $1 again, and that is still 'open'.

you might get what you want with a simple split(), but maybe you have those '\s*' because sometimes you don't have whitespace between the fields...

you could use only one regex, and with it capture both fields:

m/^Update Status:\s*?(\w+)\s*?\(\w+:?\s*?(\w+)\)/

and then:

($target, $view) = ($1, $2);

hope this helps,

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2020-02-22 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (99 votes). Check out past polls.

    Notices?