Canvas Toolkit
← Class index

CRegularExpressionValidator

util · extends CValidator

Full-value JavaScript RegExp validation with exact append-prefix Intermediate. Supports literals, dot, classes, ordinary/noncapturing groups, alternatives, greedy/lazy ?, *, + and {m,n}, and optional outer ^/$ anchors. Uses UTF-16 matching (without u/v). Flags i/s work normally; d/g/m/y do not change full-value matching. Lookarounds, backreferences, boundary assertions, named groups, scoped modifiers and legacy identity/octal escapes are rejected. Compilation is bounded to 4096 states, 64 nested groups and repeat counts 1024.

import { CRegularExpressionValidator } from "canvas-toolkit-lib";

Declared members

constructor(expression?: RegExp);
regularExpression(): RegExp;

Returns an independent copy; lastIndex never participates in validation.

setRegularExpression(expression: RegExp): void;

Compiles before committing so invalid/unsupported patterns leave the old validator intact.

validate(input: string): CValidatorState;