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.