Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing a Character in a String

Status
Not open for further replies.

SDyke

MIS
Oct 13, 2005
55
US
How can I replace the / in a string I cannot get:

myString.replace(///g,"-") to work.
 
Code:
myString.replace(/[!]\[/!]//g,"-") to work.

Putting that many slashes in a row turns the remainder of the line into a comment.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
I think you have to assing it

Code:
myString = myString.replace(/\//g,"-");

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top