Avoid unnecessary grouping

Avoiding unnecessary captured groups in your regex. If grouping is required in your regex, then use non-capturing groups to save the overall memory footprint of the regex pattern while executing.

Get Java 9 Regular Expressions now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.