refactor(compiler): refactor code matching helpers for compliance spec (#22835)

PR Close #22835
This commit is contained in:
Victor Berchet
2018-03-16 12:06:45 -07:00
committed by Matias Niemelä
parent 49396ca2ae
commit 129bb1800b
2 changed files with 32 additions and 38 deletions

View File

@ -114,6 +114,7 @@ export function getParseErrors(error: Error): ParseError[] {
return (error as any)[ERROR_PARSE_ERRORS] || [];
}
// Escape characters that have a special meaning in Regular Expressions
export function escapeRegExp(s: string): string {
return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
}