Note: I'm using pypi regex module
I have the following regex pattern (flags V1 + VERBOSE
):
(?(DEFINE)
(?P<id>[\d-]+)
)
id:\s(?&id)(,\s(?&id))*
How can I retrieve all the times the <id>
group matched ?
For example, in the following text:
don't match this date: 2020-10-22 but match this id: 5668-235 as well as these id: 7788-58-2, 8688-25, 74-44558
I should be able to retrieve the following values:
["5668-235", "7788-58-2", "8688-25", "74-44558"]
Note that this regex match the patterns, but I would like to retrieve everytime a specific group has been matched (even if it is multiple times in the same match object).