When enabling the
watched words regular expressions setting, invalid regular expressions break the specific watched word category entirely.
- Enable ‘watched words regular expressions’
- Add a watched word pattern to ‘Require Approval’, e.g.
- Add an invalid watched word pattern, e.g.
*ban*(as would be the case when having wildcards in watched words before enabling regular expressions).
- Note that a post containing ‘same issue’ will skip the approval queue, and will be ignored by the ‘Test’ form too.
- Remove the invalid watched word.
- Note that ‘same issue’ will now correctly match.
- Enable ‘watched words regular expressions’ and tags
- Add an invalid watched word pattern to ‘Tag’, e.g.
- Try posting a new topic. This will return ‘Error 500’ with the following result in
RegexpError (target of repeat operator is not specified: /*tebex.io*/) app/services/word_watcher.rb:116:in `initialize' app/services/word_watcher.rb:116:in `new' app/services/word_watcher.rb:116:in `matches?' lib/topic_creator.rb:184:in `block in setup_tags' lib/topic_creator.rb:183:in `each' lib/topic_creator.rb:183:in `setup_tags' lib/topic_creator.rb:46:in `create' lib/post_creator.rb:501:in `create_topic'
I think it’d be nice if having regular expressions disabled could still allow a valid regex to be entered similar to wildcards if, say, wrapped in a
/ block, especially since the toggle will break in a bad way if any old watched words already have wildcards.