Skip to main content
Known Participant
March 12, 2013
Question

String replace ("\" to "/")All using RegExp

  • March 12, 2013
  • 1 reply
  • 447 views

How to replace backword slah ("\") to  forward slash("/")  using regExp?

var myString="C:\Documents and Settings\Kiran Etukuri\Application Data\Macromedia\Flash Player\Logs"

This topic has been closed for replies.

1 reply

Inspiring
March 12, 2013

Expression is:

myString.replace(/\\/g, "/")

But backslash has a special meaning in strings - besides char itself it is also flag to escape the character it precedes. Thus your string value should be:

var myString:String ="C:\\Documents and Settings\\Kiran Etukuri\\Application Data\\Macromedia\\Flash Player\\Logs"