in reply to In need of a stupid regex trick
/(?<^[^"]*("[^"]*"[^"])*) / does not work: perl states that
Variable length lookbehind not implemented before HERE mark in regex
lookahead works, but. and the following code:
producesmy @a = ( 'simple', 'keep simple', 'a "bit more" difficult', 'an "increasing more" "and more" here'); foreach $_ (@a) { s/ (?=("[^"]*"[^"])*[^"]+$)/ | /g; print "$_\n"; }
simple keep | simple a | "bit more" | difficult an | "increasing more" | "and more" | here
unfortunately, the regex "confuses" split and it's not usable, at least i was not able to. but why? :)
|
|---|