0

My strings will hold the values:

"["
"[/blah]"

do I need to escape anything?

Is it just doubling the /?

3 Answers 3

4

you don't have to do anything / is not a special character

Sign up to request clarification or add additional context in comments.

Comments

2

If your string are "[" "[/blah]", then you don't need to escape anything if you use single quote:

var foo = '"[" "[/blah]"';

Comments

1

Since this is a literal string square brackets or forward slash will not be interpreted so in your example you don't need to escape anything. Doubling applies to a backward slash only \

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.