Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python regex search group

>>> m = re.match(r"(w+) (w+)", "Isaac Newton, physicist")
>>> m[0]       # The entire match
'Isaac Newton'
>>> m[1]       # The first parenthesized subgroup.
'Isaac'
>>> m[2]       # The second parenthesized subgroup.
'Newton'
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #python #regex #search #group
ADD COMMENT
Topic
Name
1+5 =