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;
In reply to Re: In search of an efficient query abstractor
by eye
in thread In search of an efficient query abstractor
by xaprb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |