Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > replacing slash with backslash
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 20th April 10:44
fabrizio cyber
External User
 
Posts: 1
Default replacing slash with backslash



Good morning,

I can't find the way to replace, in a text string, the "/" char with the "\"
char.
I know that exists an instruction called replace that has the following
sintax :

mystring = mystring.replace(/oldtext/flags , "newtext")

the problem is that my oldtext is just the slash ( / ) character!!!

Anyone can tell me which is the correct sintax for my case ???

Thanks a lot.

Fabrizio
  Reply With Quote


  sponsored links


2 20th April 10:44
steve fulton
External User
 
Posts: 1
Default replacing slash with backslash



In regular expressions, you have to escape the / with a \.
In strings, you have to escape the \ with another \.

mystring = mystring.replace(/\//g , "\\");

--
Steve

A pedestal is as much a prison as any small space. -Gloria Steinem
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666