Getting Started > ASP.NET Base Types > Regular Expressions > Details of Regular Expression Behavior > Nonbacktracking Lookahead and Lookbehind
Getting Started ASP.NET Base Types Details of Regular Expression Behavior
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-width, backtracking behavior is visible only when capturing groups appear within positive lookahead and lookbehind. For example, the expression ( ?= ( a* ) ) \1a will never find a 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, the matching engine does not retry group 1 with fewer "a" characters.
For more on grouping, lookahead, and lookbehind constructs, see Grouping Constructs
Regular Expressions