in reply to Regexp for Mysql 5.1 join Problem

Did you have a look at SQL::Statement. It can parse SQL statements into Perl OO.

I would start from the OO-representation to transform it into the form you require.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law