NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Nonbacktracking Lookahead and Lookbehind

Matching details. Positive lookahead and lookbehind do not backtrack. That is, their contents are treated in the same way as the contents of a nonbacktracking (?> ) group.

Since lookahead and lookbehind are always zero-length, backtracking behavior is only visible when capturing groups appear within positive lookahead and lookbehind. For example, (?=(a*))\1a will never match because group 1, which is defined within the lookahead, consumes as many "a" characters as there are, then \1a requires one more. Because the lookahead expression is not backtracked, group 1 is never retried with fewer "a"s.