This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes how can we get backslash-dot in string 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 "how can we get backslash-dot in string" Watch "how can we get backslash-dot in string" New topic
Author

how can we get backslash-dot in string

Gaurav Singh
Greenhorn

Joined: Jan 03, 2004
Posts: 7
Hey guys,

I am trying to do an apparantly simple replace in javascript, but can't seem to find a way to do it.

I just need to replace the dot in string "*.*" to get result "*\.*"
Following is the statement I am tryin to use

"*.*".replace(/\./gi,'\\\.');

Tried other versions as well
"*.*".replace(/\./gi,'\\\.');
"*.*".replace(/\./gi,'\.');

etc etc. None of which get me the desired result.

Can anybody please tell me a way to do this.

Thanks
Gaurav
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15385
    
    6


Eric
 
Have you checked out Aspose?
 
subject: how can we get backslash-dot in string
 
jQuery in Action, 3rd edition