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.

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

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

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.

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>

Thanks a lot. Why didn't I think of that earlier.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.