Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Parsing with RegEx into Array

by mr_p (Scribe)
on Jun 25, 2010 at 18:17 UTC ( #846579=note: print w/ replies, xml ) Need Help??


in reply to Re: Parsing with RegEx into Array
in thread Parsing with RegEx into Array

that worked perfectly. but what If <item> is < item> (with a space in it. Is there a way to handle it?


Comment on Re^2: Parsing with RegEx into Array
Re^3: Parsing with RegEx into Array
by ikegami (Pope) on Jun 25, 2010 at 18:31 UTC

    Are you really asking how to optionally match a space with a regex?

Re^3: Parsing with RegEx into Array
by JediWizard (Deacon) on Jun 25, 2010 at 18:31 UTC

    $str =~ m{<\s*item\s*><i>(.*?)</i></\s*item\s*>}

    They say that time changes things, but you actually have to change them yourself.

    —Andy Warhol

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (15)
As of 2015-07-06 15:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls