Add the /g global flag, so all occourances of the '#' get replaced with ...

...the encoded %23' value. Closes #1961