var patt = /^[(][0-9][)]$/;
var text = "(1)"
console.println("did not find it");
There are two kinds of regular expressions, when it comes to parentheses, but I think the problem is actually that, because the regex is in a string, the backslash is processed as part of the string parsing, and no longer there when it comes to be treated as a regex. Perhaps \\ would succeed.
Replace your first line with this:
var patt = /^\(Re: Question about RegExp and escaping ()\)/;
I never use the new RegEx() syntax, getting things right on the first try
with the /.../ syntax is much easier
Karl Heinz Kremer
Just change the first line to:
var patt = /^\([0-9]+\)/;
That was it. Everyone else's posts did not work. The + sign was the magic ingredient.