in reply to multiple OR match fails
That can easily done like this (I simplified your regex, as the missing parenthesis makes it unclear, what you really want):
while(<STDIN>) { # see previous answer #undef ($/); $string=$_; my @matches = ($string =~ m/(FINDINGS|COMPLICATIONS|:.*)/g); print STDOUT "@matches \n"; } echo "FINDINGS COMPLICATIONS :something" | t.pl
However from your question it seems, what you really want is not just to get a list of matches, but some sort of parsing. eg. extract the text from the section "FINDINGS" etc.
To answer this, it would be necessary to know, where a section ends. If this is not, what you wanted, please clarify.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: multiple OR match fails
by zzgulu (Novice) on Jan 31, 2012 at 15:36 UTC | |
by Marshall (Canon) on Jan 31, 2012 at 22:41 UTC |