From the course: Learning Regular Expressions

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Lookbehind assertions

Lookbehind assertions

- In this movie, we will learn about lookbehind assertions, both positive and negative. Lookbehind assertions are true if a grouped expression is or is not behind the current position. They're similar to lookahead assertions. As their name suggests, lookahead assertions look forward and lookbehind assertions look backwards. And lookbehind assertions are also not included in the match or captured. They just return true or false. They aren't as well supported as lookahead assertions. JavaScript support is being added but it isn't the same for every browser so use them with some caution in JavaScript. The metacharacters are similar to the lookahead assertions, but they add a less than sign to indicate that they look backwards so it looks like it's pointing to the left. So question mark less than equals indicates a group is a positive lookbehind assertion, and question mark less than exclamation point indicates that a group is…

Contents