Skip to content

Tag: capture-group

Are non-capturing groups redundant?

Are optional non-capturing groups redundant? Is the following regex: semantically equivalent to the following regex? Answer Your (?:wo)?men and (wo)?men are semantically equivalent, but technically are different, namely, the first is using a non-capturing and the other a capturing group. Thus, the question is…