Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can we get backslash-dot in string

 
Gaurav Singh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic