is it possible to capture only multiple characters within ‘or’?
i would like this [(abc)(cde)]
to capture abc or cde however it captures ( or a or b or c or ) ...
i saw this: regular-expression-capture-groups-which-is-in-a-group
is what i’m asking not possible in regular expressions? it sounds too obvious and far needed, for me not to exist in it…
You want this:
This matches either
abcorcdeand captures the result in a backreference. If you don’t need the backreference, useAnother hint: If you want to make sure that you only match entire words, not substrings within a longer word like
abcwithintabcontrol, use word boundaries: