File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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: 1559
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: 63548

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] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Replaceing Characters
It's not a secret anymore!