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 think you might just want to do

  s/(,|R\.)\s/$1\n/g;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to