As I understand it the backslash character is special in both the regex and the 
replacement string, so it has to be double escaped in both places. That means, 
for every single backslash you want to match or insert, you have to put *four* 
backslashes in the regex or replacement string.

--- In flexcoders@yahoogroups.com, Nick Middleweek <nick@...> wrote:
>
> Hi,
> 
> I'm trying to replace a double slash with a single slash and am having a
> little trouble, has anyone done this before?
> 
> Here's what I've got thus far...
> 
> var doubleSlash : RegExp = /(\\)(\\)/g;
> var slash : RegExp = /(\\)/;
> 
> winMessage = winMessage.replace( doubleSlash, slash );
> 
> 
> Cheers,
> Nick
>


Reply via email to