in reply to Re^2: In search of an efficient query abstractor
in thread In search of an efficient query abstractor
At least for the last case, Perl has an optimized version:
$query =~ tr[ ][]s;
and it should be faster or at least as fast as the s/// version. Another version to try would be s/\s+/ /g - there is no need to use the counting variant of {2,}, and skipping might be slower than just writing the output "replacement".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: In search of an efficient query abstractor
by xaprb (Scribe) on Dec 08, 2008 at 01:19 UTC |