in reply to Re^3: Analyzing regular expression performance
in thread Analyzing regular expression performance
I do think you are insane to parse SQL with regular expressions, but if you are brave and insist on this approach, I would suggest a multi-pass approach.
Write one pattern that strips out comments. Write another pattern to coalesce blanks into a single blank. Then you will find that writing a third pattern to pick apart an expression becomes much easier. At least you won't need so many nested 0-or-many groupings -- that is what is killing your performance.
I tried to run your code and it ate up all available memory... I do no think this approach will scale.
• another intruder with the mooring in the heart of the Perl
|
|---|