July 2017
Intermediate to advanced
158 pages
3h 41m
English
We come across so many examples of regular expressions on the internet that promote unnecessary capturing groups. If we are not extracting any substring or not using a group in backreferences, then it is better to avoid capturing groups by using one or more of the following ways:
(a|e|i|o|u)
So, instead of using the preceding regex, we can use the following:
[aeiou]
(red|blue|white)
Instead of the previous regex, we can use the following:
(?:red|blue|white)
Read now
Unlock full access