Changing $string =~ s/(b)(?!.*b)$/x/; to this $string =~ s/b(?!.*b)$/x/; [download]
In reply to Re^2: RE - match from right by shenme in thread RE - match from right by bangers