python - regex: combine capturing group with OR condition - Stack Overflow


PHOTO EMBED

Wed Oct 28 2020 10:58:52 GMT+0000 (UTC)

Saved by @SwarleyBL #python

>>> [a+b for a,b in re.findall('id_([a-z]+)|num([0-9]+)', s)]
['john', '847']
content_copyCOPY

https://stackoverflow.com/questions/50144074/regex-combine-capturing-group-with-or-condition