export class Regex { public static escape(str: string): string { // https://stackoverflow.com/questions/1144783/how-to-replace-all-occurrences-of-a-string-in-javascript return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string } }