in reply to Re: Quick regex substitution question
in thread Quick regex substitution question

Yeah I've been trying to implement a look-ahead assertion, but it's not working. I been trying something like this...

$string =~ s/\;(?!\;$)//g;

I thought it would find all occurrences of ; but not the last one followed by end-of-line, but it's not working. There's something I don't understand.

Replies are listed 'Best First'.
Re^3: Quick regex substitution question
by ww (Archbishop) on May 29, 2015 at 16:02 UTC

    Part of your problem is your attempt to escape the semicolons. They're NOT end_of_statement markers to Perl or its regex engine when inside a quoted string. You may also want to read about using '!' as a negation.