in reply to regular expression code not working

Maybe it was at the end of the string, with no following newline. I would use this:

s/^\s*\)\s*($|\n)/);/;

Replies are listed 'Best First'.
Re^2: regular expression code not working
by Ratazong (Monsignor) on Dec 04, 2010 at 21:48 UTC
    I assume your conclusion is right. Depending on your data, you might even solve it with an easier regex:
    s/\)$/\);/; # replace an ) at the end of the line with an );
    HTH, Rata