Exploring Zero-Width Assertions, Lookarounds, and Atomic Groups


You will learn about zero-width assertions in Java regular expressions. We will cover various zero-width assertions and their usage patterns. We will then move on to learn the important topic of lookahead and lookbehind assertions in Java regular expressions and how to use them to solve some important problems. We will also discuss the use of atomic groups in Java regular expressions.

We will cover the following topics in this chapter:

  • Zero-width assertions
  • Previous match boundary
  • Atomic groups
  • Lookahead assertions: positive and negative
  • Lookbehind assertions: positive and negative
  • Capturing text from overlapping matches
  • Capturing groups inside lookahead and lookbehind groups ...

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.