Regex named groups
Section: Regular expressions and subprocess
Regex named groups
python
python
import re
match = re.search(r"(?P<user>\w+)@(?P<host>[\w.]+)", email)
parts = match.groupdict()Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Regular expressions and subprocess