in reply to regular expression code not working

i changed it to this and it worked s/^\)/\);\n/; but i am worried as this is published code and I don't understand why the original expression failed for me