(a|b)\1
What does \1 mean in this expression?
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.
\1– it means the first capturing group in the matched expression.\nwould be the nth capturing group. (Note that\0would be whole match). In many engines, the upperlimit for n is 9, but some support up to 99 as well.When used in regex like
(a|b)\1, it means that after a or b, the next character should be the first captured group, which is a or b so the regex here would matchaaorbb.