Computer Science Canada [Regex-tut] Nested Capturing Groups |
Author: | wtd [ Sat Nov 13, 2004 11:04 pm ] | ||||||
Post subject: | [Regex-tut] Nested Capturing Groups | ||||||
Thus far... As it is, I've only shown examples of capturing groups which are laid out linearly. The previous example was:
What if... What if I want to match that entire thing, including the quotes?
Notice that the parentheses are now nested, and \1 has become \2. This is because group 1 is now the entire thing. Group 2 is the quote. The simple rule The opening parenthesis determines the number of the group. Another group following:
Would be group 3. |