If you want to group a certain sub-expression in a regular expression, without the need to capture it (into the $1
, $2
, $3
, etc. variables and related capture variables), then you should cluster them using (?: … )
instead of capturing them using a plain ( … )
, or alternatively not grouping them at all if it's needed. That is because using a cluster is faster and cleaner and better conveys your intentions than using a capture.