Learn Java Programming - Regex Non-Capturing Groups Tutorial

Published: 27 February 2016
on channel: Daniel Ross
1,433
13

A non-capturing group allows you to group a pattern (token) without the regex engine automatically assigning a group number. There are many reasons for using non-capturing groups, some common uses are: faster search results, inline modifiers (or embedded flag expressions), and excluding patterns from the .group(...) method results. At this point I would like to take a moment to make you aware that the ? metacharacter is just about the most versatile of all the metacharacters and where it is placed in a regex can make a dramatic difference on search results. Non-capturing groups use the same syntax as capturing groups only you must include a ?: just inside of the opening parenthesis.

Inline Modifiers, aka Embedded Flag Expressions
If you have been watching my tutorial series thus far, then you have seen me demonstrate the case-insensitive inline modifier (?i)...


On this page of the site you can watch the video online Learn Java Programming - Regex Non-Capturing Groups Tutorial with a duration of hours minute second in good quality, which was uploaded by the user Daniel Ross 27 February 2016, share the link with friends and acquaintances, this video has already been watched 1,433 times on youtube and it was liked by 13 viewers. Enjoy your viewing!