in reply to phrase and word searching
The first regular expression returns a list like so:my $str = qq|"this is one" and "anot""her one" is "" right "her"e|; my @stuff = map { /([^"]+)"$/ } $str =~ /"([^"]*"|[^\s"]+)/g; print join("\n", @stuff), "\n";
and the second regex inside the map removes the left over quote and, as a feature of map, doesn't return the 'empty' ones - so the final list looks like:this is one" anot" her one" " her"
I am sure that this process could be compacted into yet another single regex, but it eludes me.this is one anot her one her
Jeff
R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
L-L--L-L--L-L--L-L--L-L--L-L--L-L--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: phrase and word searching
by Vynce (Friar) on Jun 01, 2001 at 07:38 UTC |