Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
My strings will hold the values:
"[" "[/blah]"
do I need to escape anything?
Is it just doubling the /?
you don't have to do anything / is not a special character
Add a comment
If your string are "[" "[/blah]", then you don't need to escape anything if you use single quote:
var foo = '"[" "[/blah]"';
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 \
\
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.