The pattern I want to match is [{Any text between here}]
my regex:
/\[\{[\W\w]*?\}\]/
I am using preg_match_all()
It is working so far but I was wondering if there is a better solution?
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.
If you want to find match that includes
[{and}]then useIf you want match just inside text, then use
If text inside may contain
}character (e.g. [{hello}yellow}]), then replace[^}]+with.+?in both above regex patterns. The original patterns have better performance, as they are not using lazy operator?.