544
545
export function unicodeEscapesToPCRE2(pattern: string): string {
547
>
const unicodePattern = /((?:[^\\]|^)(?:\\\\)*)\\u([a-z0-9]{4})/gi;
548
>
549
>
while (pattern.match(unicodePattern)) {
550
>
pattern = pattern.replace(unicodePattern, `$1\\x{$2}`);
551
>
}
552
>
553
>
// Match \u{1234}
554
>
// \u with 5-6 characters will be left alone because \x only takes 4 characters.
555
>
const unicodePatternWithBraces = /((?:[^\\]|^)(?:\\\\)*)\\u\{([a-z0-9]{4})\}/gi;
556
>
while (pattern.match(unicodePatternWithBraces)) {
557
>
pattern = pattern.replace(unicodePatternWithBraces, `$1\\x{$2}`);
558
>
}
559
>
560
>
return pattern;
561
>
}
562
563
export interface IRgMessage {