Escape special regex characters

Running tests were failing because the `[]` characters were not escaped
causing regex to match the wrong pattern/areas of the file.