When regular expressions are used as
patterns to match the input strings, it results in groups of strings that have matched the pattern. These groups can be accessed using a back reference \n where n is the index of the group captured. I didn't understand the following table.
Whole content Regular expression Result
abab ([a-z][a-z])\1 Found the text "abab" starting at
index 0 and ending at index 4.
abcd ([a-z][a-z])\1 No match found
abcd ([a-z][a-z]) Found the text "ab" starting at
index 0 and ending at index 2.
and the text "cd" starting at
index 2 and ending at index 4
Can anybody please help me to undetstand above?
Thanks