2👍
✅
You can be explicit about the delimiter and list the possible delimiters inside square brackets:
(?P<token>[a-zA-Z0-9_.-]{2}[\-_][a-zA-Z0-9_.-]{6}[\-_][a-zA-Z0-9_.-]{27})
Here we are setting the delimiter to be -
or _
.
Source:stackexchange.com