in reply to phrase and word searching

And here is another way (you can wrap it in a function if you wish) that returns the text inside the quotes without the qoutes:
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";
The first regular expression returns a list like so:
this is one" anot" her one" " her"
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.

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