diff --git a/src/constructs/character-class.ts b/src/constructs/character-class.ts index 105c5ed..880e52d 100644 --- a/src/constructs/character-class.ts +++ b/src/constructs/character-class.ts @@ -152,6 +152,11 @@ export function negated(element: CharacterClass): CharacterClass { }; } +/** + * @deprecated Renamed to `negated`. + */ +export const inverted = negated; + function encodeCharacterClass(this: CharacterClass): EncodeResult { if (this.chars.length === 0 && this.ranges.length === 0) { throw new Error('Character class should contain at least one character or character range'); diff --git a/src/index.ts b/src/index.ts index 5d7069e..d07b03b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,6 +17,7 @@ export { charRange, digit, negated, + inverted, nonDigit, nonWhitespace, nonWord, diff --git a/website/docs/api/assertions.md b/website/docs/api/assertions.md index 2761d05..aacc76d 100644 --- a/website/docs/api/assertions.md +++ b/website/docs/api/assertions.md @@ -23,11 +23,11 @@ _This API was added in version 1.3.0._ ```ts const wordBoundary: Anchor; -const notWordBoundary: Anchor; +const nonWordBoundary: Anchor; ``` - `wordBoundary` matches the positions where a word character is not followed or preceded by another word character, effectively indicating the start or end of a word. Regex syntax: `\b`. -- `notWordBoundary` matches the positions where a word character is followed or preceded by another word character, indicating that it is not at the start or end of a word. Regex syntax: `\B`. +- `nonWordBoundary` matches the positions where a word character is followed or preceded by another word character, indicating that it is not at the start or end of a word. Regex syntax: `\B`. Note: word characters are letters, digits, and underscore (`_`). Other special characters like `#`, `$`, etc are not considered word characters.