I am not able to give “[” directly as it considers it as char set. If i try giving “[”
, i get a error saying escape sequence is not possible for “[“.
I am not able to give [ directly as it considers it as char
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Escape it with a double backslash:
This is needed to stop the regex engine treating the
[as the start of a character class.The first backslash is needed since the
\\[is part of a string literal; only the second backslash will make it to the regex engine. In other words, the regex engine will see the above as\[.