Add the /g global flag, so all occourances of the '#' get replaced with the encoded %23' value. Closes #1961
Fix replace() call by removing single quotes and adding leading slash.
Merge pull request #717 from jevonearth/develop

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