Just to add for clarity - the reason that it did not work before is because the period (.) is a regexp universal character that matches anything other than a newline character (\n). I'm guessing that since you had declared your regexp to be global (by the g on the end of the regexp) that your entire string was being replaced by an empty string ("") because the period was matching every character in the string.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.