UNPKG

ts-regex-builder

Version:

Maintainable regular expressions for TypeScript and JavaScript.

1 lines 1.02 kB
{"version":3,"file":"negative-lookbehind.mjs","names":["encode","negativeLookbehind","sequence","precedence","pattern"],"sources":["../../../src/constructs/negative-lookbehind.ts"],"sourcesContent":["import { encode } from '../encoder';\nimport type { EncodedRegex, RegexSequence } from '../types';\n\n/**\n * Negative lookbehind assertion.\n *\n * A negative lookbehind assertion is a zero-width assertion that matches a group of characters only if it is not preceded by a specific group of characters.\n *\n * @example\n * ```ts\n * negativeLookbehind(\"a\");\n * // /(?<!a)/\n *\n * negativeLookbehind([\"a\", \"b\", \"c\"]);\n * // /(?<!abc)/\n * ```\n */\nexport function negativeLookbehind(sequence: RegexSequence): EncodedRegex {\n return {\n precedence: 'atom',\n pattern: `(?<!${encode(sequence).pattern})`,\n };\n}\n"],"mappings":"SAASA,MAAM;AAiBf,OAAO,SAASC,kBAAkBA,CAACC,QAAuB,EAAgB;EACxE,OAAO;IACLC,UAAU,EAAE,MAAM;IAClBC,OAAO,EAAG,OAAMJ,MAAM,CAACE,QAAQ,CAAC,CAACE,OAAQ;EAC3C,CAAC;AACH","ignoreList":[]}