Watched word regular expression crash

This is a twofold bug.

First, an error in a regular expression causes a 500 server error when any post is made.
See also this prior bug report Invalid regular expressions in 'Watched Words' makes no watched word work (scenario: worse).

Second, a previously correct regular expression which escapes a dash, is now seen as incorrect. So where \- used to work prior to 3.1.0 stable, it now causes a fatal error.

This is probably happening because of Unicode being enabled in 9a27803.

See Regular expression syntax cheat sheet - JavaScript | MDN

Note that some characters like :, -, @, etc. neither have a special meaning when escaped nor when unescaped. Escape sequences like \:, \-, \@ will be equivalent to their literal, unescaped character equivalents in regular expressions. However, in regular expressions with the unicode flag, these will cause an invalid identity escape error. This is done to ensure backward compatibility with existing code that uses new escape sequences like \p or \k.

but it would be nice if there was an exception handler here.

9 Likes

We have this prioritized now, will get to it in the next 4 weeks.

7 Likes