Jump to content

.replace()


astralaaron
 Share

Recommended Posts

I've been having trouble with this. Will someone point out my error? I searched around and nothing I found worked.varA = "it's a test, it's a test";*one example I've triedvarB = varA.replace(/\'/g, "\'");*another example...varB = varA.replace(/'/g, "\'");(trying to get "it\'s a test, it\'s a test" to output)varB = varA.replace(/(['])/g, "\\\'"); ended up working like I need... thanks anyway!

Edited by astralaaron
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...