Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Regex Optional capture doesn't

by NetWallah (Canon)
on Oct 05, 2017 at 16:19 UTC ( #1200743=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    <blah1 phase="2" type="MyType" more_keys="Values" <Unwanted/>  <SomeTa
    +gIwant><k1="v1"></SomeTagIwant>
    
  2. or download this
    \btype="([^"]+)".+<(\w+TagIwant\b)
    
  3. or download this
     perl -E '$x=q|<blah1 phase="2" type="MyType" more_keys="Values" <Unwa
    +nted/>  <SomeTagIwant><k1="v1"></SomeTagIwant>|;  say for $x=~/\btype
    +="([^"]+)".+<(\w+TagIwant\b)?/'
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1200743]
Approved by Perlbotics
help
Chatterbox?
LanX God shaves the Queen!
[marto]: plastering
LanX citing Sean Connery
[LanX]: met a guy from Aberdeen durin holidays, liked Scotsish accent a lot ... very phonetic
[LanX]: ... understood everything after mentally write down what he said.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2018-02-19 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (261 votes). Check out past polls.

    Notices?