export function replaceNotMatching()

in src/RegExpI18n.ts [60:73]


export function replaceNotMatching(pattern: string, replaceValue: string, text: string): string {
    let record = regexpCache[pattern];
    if (!record) {
        record = {
            matchRegexp: createRegExp(pattern + '|.', 'g'),
            validator: createRegExp(pattern)
        };
        regexpCache[pattern] = record;
    }
        
    return text.replace(record.matchRegexp, (ch) => {
        return record.validator.test(ch) ? ch : replaceValue;
    });
}