This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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: 1462
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: 61310

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]
GeeCON Prague 2014
subject: Replaceing Characters