javascript - Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ ) in java -
i using url matching parent domain , i-frame domain. getting error put below code inside java class.
out.print("ref = url.match(/:\/\/(.[^/]+)/)[1];");
getting error line:
invalid escape sequence (valid ones \b \t \n \f \r \" \' \\ )
original script:
out.print("<script>");
//need put below line inside java class, using out.print(" ");
ref = url.match(/:\/\/(.[^/]+)/)[1]; out.print("</script>");
how use correctly?
in java string, have backslash have escape backslash. \
should escaped \
in out.print
line:
out.print("ref = url.match(/:\\/\\/(.[^/]+)/)[1];"); // ^ ^
that outputs this:
ref = url.match(/:\/\/(.[^/]+)/)[1];
Comments
Post a Comment