Community Patterns

Community Library Entry

0

Regular Expression
Created·2019-03-19 09:08
Flavor·PCRE (Legacy)

Description

Matches x only if x is not preceded by y.This is called a negated lookbehind.

For example, /(?<!-)\d+/ matches a number only if it is not preceded by a minus sign. /(?<!-)\d+/.exec('3') matches "3". /(?<!-)\d+/.exec('-3') match is not found because the number is preceded by the minus sign.

Submitted by anonymous