I have this string
[X=(any number)] (any character, include space) [/X]
Example: [X=5]Test string[/X]
I test with /(\[)(X=)(\d+\])(\w\s\.)(\[/X\])/gi but it doesn’t work.
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.
The problem is that the
/needs to be escaped as well. Also it’s not very useful to group constant matches. Lastly, you’re matching(\w\s.)but this only allows one word character, one space character and one character of any type, in this order. I don’t see what’s the use of that. Try:This will group the two variable parts.