https://javascript.info/regexp-escaping > Here’s a full list of them: [ \ ^ $ . | ? * + ( ) It seems to me you forgot the `{` , which also needs to be escaped outside a class. Let's say we want to match literally `{3}` , the regular expression should be `var patt = /\{3}/;`