in reply to In search of an efficient query abstractor
since you already collapsed whitespace on the line before.$query =~ s/[\n\r\f]+/ /g;
You might get better performance out of:
by replacing it with:$query =~ s/(["']).*?\1/S/g;
This avoids capturing characters which may or may not help. Also, you could potentially handle double quoted (") strings earlier in the sequence of regexen if that would reduce the number of potential real number strings exposed to your regex for real numbers and floats.$query =~ s/"[^"]*"/S/g; $query =~ s/'[^']*'/S/g;
Finally, in:
You can take advantage of the fact that you have already normalized whitespace:$query =~ s{ \b(in|values?)\s*\(\s*([NS])\s*,[^\)]*\) } {$1($2+)}gx;
$query =~ s{ \b(in|values?) *\( *([NS]) *,[^\)]*\) } {$1($2+)}gx;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: In search of an efficient query abstractor
by xaprb (Scribe) on Dec 07, 2008 at 20:40 UTC | |
|
Re^2: In search of an efficient query abstractor
by xaprb (Scribe) on Dec 08, 2008 at 01:02 UTC |