in src/app/webserver/url-rewrite/outbound-rules/outbound-rule-settings.ts [125:159]
private testRegex(): void {
this.reset();
if (!this.rule.pattern || !this._testUrl) {
return;
}
let regex: RegExp;
try {
let ignoreCase = + this.rule.ignore_case ? 'i' : '';
regex = new RegExp(this.rule.pattern, 'g' + ignoreCase);
}
catch (e) {
this._matches = [];
return;
}
this._matches = regex.exec(this._testUrl) || [];
this._isMatching = (this._matches.length > 0 && !this.rule.negate) ||
(this._matches.length == 0 && this.rule.negate);
if (this.rule.negate) {
this._matches.splice(0, this._matches.length);
}
let result = this.rule.rewrite_value || "";
for (let i = 0; i < this._matches.length; i++) {
result = result.replace(new RegExp('{R:' + i + '}', 'g'), this._matches[i]);
}
this._result = result;
}