0

Hi, I need some help detecting the escape character '\'. It doesn't show up when it's in a string. I'm trying to convert '/\' into '&&' and '\/' into '||'. Help is much appreciated. Thanks.

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Agent Cosmic
0

I need some help detecting the escape character '\'.

Please provide an example of the input string and the desired output.

0

Most of them comes in the form of arguments.
For example, 'a\/b(c/\a)'.
It's like doing 'a||b(c&&a)' in Javascript.

0

For example, 'a\/b(c/\a)'.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
    <title></title>
  </head>
  <body>

    <pre id="arg_in">
'a\/b(c/\a)'

</pre>
    <pre id="arg_out">
 
</pre>

    <script type="text/javascript">
	var arg_wrk = document.getElementById("arg_in").firstChild.data;
	arg_wrk = arg_wrk.replace(/\\\//g, '||');
	arg_wrk = arg_wrk.replace(/\/\\/g, '&&');
	document.getElementById("arg_out").firstChild.data = arg_wrk;
    </script>

  </body>
</html>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.