The following code gets the number of captured groups using Python regex in given string
Example
import re m = re.match(r"(\d)(\d)(\d)", "632") print len(m.groups())
Output
This gives the output
3
The following code gets the number of captured groups using Python regex in given string
import re m = re.match(r"(\d)(\d)(\d)", "632") print len(m.groups())
This gives the output
3