Archive for March 2008
A JScript / VBScript Regex Ugly Bug
Here’s one of the oddest and most significant regex bugs in Internet Explorer. It can appear when using optional elision within lookahead (e.g., via ?, *, {0,n}, or (.|), but not +, interval quantifiers starting from one or higher, or alternation without a zero-length option). An example in JavaScript:
/(?=a?b)ab/.test(”ab”);
// Should return true, but IE 5.5 – 8b1 return false
/(?=a?b)ab/.test(”abc”);
// Correctly returns true (even in IE), although the
// added “c” does not take part in the match