Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python named group regex example

>>> re.search(r'(?P<name>[^-]+)-(?P<ver>d.d.d-d+).tar.gz', 'package_name-1.2.3-2004.tar.gz').groupdict()
{'name': 'package_name', 'ver': '1.2.3-2004'}
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #python #named #group #regex
ADD COMMENT
Topic
Name
3+9 =