Working with Groups, Capturing, and References

In this chapter, you will learn how to match, capture, and reference substrings from a given input text using regular expressions. We will cover various types of groups available in Java, and the naming and numbering of captured groups. Readers will also learn how to use back reference or forward reference of the capturing groups.

We will be covering the following topics in this chapter:

  • Grouping
  • Capturing groups
  • Group numbering
  • Non-capturing groups
  • Back references
  • Named groups
  • Forward references
  • Invalid references

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.