Positive lookahead

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

The following is its syntax:


For example, \d+(?=##) asserts that there must be a string, ##, immediately after 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.