Two Laptop Bag
The moose likes HTML, CSS and JavaScript and the fly likes Replaceing Characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Replaceing Characters" Watch "Replaceing Characters" New topic

Replaceing Characters

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
How can I use javascript to replace the / in a string?

I have tried myString.replace(///g,"") but it generates an error.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63343

You need to bone up on regular expression syntax. because the / is used as the delimiter, you cannot just use it straight-away inside the expression. You need to delimit it the same way you would delimit a quote inside a string literal.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Replaceing Characters
It's not a secret anymore!