Saturday, 1 November 2014

Capturing Groups

Capturing Groups provide a way to specify multiple characters as single unit.

Ex:
(XYZ)
((X)(Y(Z)))

Capturing groups are numbered by counting their opening parentheses from left to right. For Example, in the expression '((Z)(Y(Z)))' there are four capturing groups.

1. ((X)(Y(Z)))
2. (X)
3. (Y(Z))
4. (Z)

Sample Output
Enter Regular Expression
(ab){2}\s(ab)
Enter the string
abab ab
I found the text abab ab starting at index 0 Ending at index 7

Note:
Use this program to run above sample



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment