in reply to phrase and word searching

Here's a regex that should get you started: /("[^"]*"|[^\s"]+)/g; This regex makes two following assumptions: a word is a sequence of non-whitespace, non-quote characters, and a quotation cannot contain embedded quotes. Here's an example:
sub split_text { $_[0] =~ /("[^"]*"|[^\s"]+)/g; } my $text = 'The dog said "Hi, how are you?" I laughed.'; my @pieces = split_text($text); print "$_\n" for @pieces; __END__ The dog said "Hi, how are you?" I laughed.

Replies are listed 'Best First'.
Re: Re: phrase and word searching
by ManyCrows (Novice) on Jun 01, 2001 at 01:52 UTC
    perfection! muchos gracias!