Non-capturing Groups

Length: 00:06:24

Lesson Summary:

We've learned about capturing groups: Now what about when we want to use parenthesis as visual helpers for when humans read our regexs and not capture anything with them? Luckily, we can turn our capturing groups into non-capturing groups for just this reason. Non-capturing groups allow us to use grouping without that group being counted towards any of our numerical backreferences. To demonstrate this, we further refactor our table of contents one-liner, switching from grep and sed to Perl to print out our captured heading, all while ignoring the matched HTML tags.

Get the lesson files here!:


This lesson is only available to Linux Academy members.

Sign Up To View This Lesson
Or Log In

Looking For Team Training?

Learn More