in reply to Re^2: Break string into array
in thread Break string into array
Not only does your solution allow
it parses to the same asmy $s = q[dogs OR cats AND "flying fish" OR (shrimp AND squid)];
my $s = q[dogs OR cats OR "flying fish" OR (shrimp AND squid)];
And it also allows
my $s = q[OR dogs OR cats OR "flying fish" OR (shrimp AND squid)];
Finally, quoted strings are left quoted. A parser shouldn't return literals. If you want to differentiate between quoted and unquoted terms, you'll need to add to the parse tree.
$VAR1 = [ "OR", [ term => "dogs" ], [ term => "cats" ], [ phrase => "flying fish" ], [ "AND", [ term => "shrimp" ], [ term => "squid" ], ] ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Break string into array
by Anonymous Monk on Sep 18, 2009 at 15:23 UTC | |
by ikegami (Patriarch) on Sep 18, 2009 at 16:22 UTC |