Python Tip #319 (of 365): Name your regular expression capture groups. Capture g...
Trey Hunner π @treyhunner@mastodon.social
Python Tip #319 (of 365):
Name your regular expression capture groups.
Capture groups are neat, but it can be confusing figuring out what the group numbers represent:
>>> match = reβ.search(r"(\d{2})/(\d{2})/(\d{4})", "from 12/22/1629")
>>> match[3]
'1629'
π§΅ (1/3)