On Feb 26, Boris Shor said:
$e1 = ','; $aye =~ s/(?<!($e1))\s/\n/g;
So this expression replaces spaces with newlines except when they are immediately preceded by a comma. But when I change
$e1 = ',|R\.'
(English: comma or "R."), I get "Variable length lookbehind not implemented
in regex"
Because ',' and 'R\.' match 1 and 2 characters, so the lookbehind is NOT a
constant width. You'd need to do
s/(?:(?<!,)|(?<!R\.))\s/\n/g;
??? I don't think that's gonna work. Let me check... No, doesn't seem to. There is always NOT going to be a proceeding comma OR NOT going to be a proceeding R., so it changes all spaces. Luckily, the fix is even easier:
s/(?<!,)(?<!R\.)\s/\n/g;
I think you might just want to do
s/(,|R\.)\s/$1\n/g;
This doesn't work either. It has the exact opposite goal the the poster stated. This changes all whitespace characters following a comma or an R. to newlines. The goal was to change spaces to newlines EXCEPT when proceeded by a comma or R., I believe. I also don't know how to fix this version, so I suggest the solution above.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
