in reply to Re^2: regex needed to remove parts of SQL
in thread regex needed to remove parts of SQL
Looks like the problem was that (?:) is non-capturing grouping. It stills eats up the characters. What you need is lookbehind (?<=).$sql =~ s/(?<=select)\s*[^,]*?\s+as//gi ; $sql =~ s/(?<=,)\s*[^,]*?\s+as//gi ;
I also tried
But the interpreter refused and said$sql =~ s/(?<=select|,)\s*[^,]*?\s+as//gi ;
So, it looks like you have to have two regexes if you do not want to use $1.Variable length lookbehind not implemented in regex
Oguz
---------------------------------
life is ...
$mutation = sub { $_[0] =~ s/(.)/rand()<0.1?1-$1:$1/ge };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: regex needed to remove parts of SQL
by jeanluca (Deacon) on Sep 12, 2007 at 12:08 UTC |