Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Regex problems using '|'

by pjotrik (Friar)
on Jul 22, 2008 at 09:05 UTC ( #699240=note: print w/replies, xml ) Need Help??


in reply to Regex problems using '|'

How about
foreach my $vulnerabilityText (@records) { $vulnerabilityText =~ m/(Remediation Report|.+)/; my $vulnerabilityName = $1; print($vulnerabilityName, "\n"); }

Replies are listed 'Best First'.
Re^2: Regex problems using '|'
by romandas (Pilgrim) on Jul 22, 2008 at 09:18 UTC
    Whoops. I posted the wrong pattern. The one I needed to work wouldn't work correctly with the grouping behavior of (), since I had to match on unique text in record 1 to locate the same information that's at the top in the other records.
      OK, that makes it something like:
      foreach my $vulnerabilityText (@records) { $vulnerabilityText =~ m/(Remediation report\n\n)?(.+)/; my $vulnerabilityName = $2; print($vulnerabilityName, "\n"); }
      I'm not sure about the newlines, but you'll work that out.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2023-11-28 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?