Jan 12

When needing to perform a String.replace() with some regex and globally replace text. You must remember to put the “g” argument like so:

var str = “‘http://www.com/123/123′”

str.replace(/’/g,”")

Spent a few minutes banging my head on this one.  So remember the “g”!

Tagged with: