Is it possible to make a regular expression to match everything within single brackets but ignore double brackets, so for example in:
{foo} {bar} {{baz}}
I’d like to match foo and bar but not baz?
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.
To only match
fooandbarwithout the surrounding braces, you can useif your language supports lookbehind assertions.
Explanation:
EDIT: In JavaScript, you don’t have lookbehind. In this case you need to use something like this: