If I have, for example, the below regex string:
'^/abc/(?P<some_int>\d{3})/\d{0,2}/$'
Is there an easy way to determine when a group is a number/int?
I know that it is an int, but say this needed to be processed somewhere else and it needed to be deduced from just the m开发者_开发百科atch object.
m.group(WHICHEVER_YOU_WANT).isdigit()
You are matching it with \d{3}
so it will match only if it is a number with three digits ( including leading zeroes)
精彩评论