← Back to release summary

RegExp lookbehind assertions

Category
JavaScript
Type
New or changed feature
Status
Enabled by default (Chrome 62)
Intent stage
None

Summary

Lookarounds are zero-width assertions that match a string without consuming anything. ECMAScript has lookahead assertions that does this in forward direction, but the language is missing a way to do this backward which the lookbehind assertions provide. With lookbehind assertions, one can make sure that a pattern is or isn't preceded by another, e.g. matching a dollar amount without capturing the dollar sign.

Standards & signals

Docs: https://mathiasbynens.be/notes/es-regexp-proposals#lookbehinds https://developers.google.com/web/updates/2017/07/upcoming-regexp-features#lookbehind_assertions

View on chromestatus.com