Positive lookbehind

A positive lookbehind assertion asserts true if the pattern inside the lookbehind is matched.

Here is its syntax:


For example, (?<=##)\d+ asserts that there must be a ## string just before matching one or more digits.

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.