Summary

In this chapter, we learned zero-width assertions and how they are crucial for solving some important matching problems. We discussed the boundary matcher, \G, and its usefulness in solving some problems. We discovered the idea behind atomic groups and understood how they can improve the overall regex performance. Then, we covered all the important lookahead and lookbehind patterns. We covered some interesting matching, validation, and splitting problems that are solved using lookarounds.

In the next chapter, we will continue to learn advanced concepts of Java regular expressions, such as union and intersection within character classes, and negated character classes.

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.