Watched word regular expression crash (2025)

That won’t prevent people entering “normal” wildcard expressions, and then turning on watched words regular expressions enabled, which is what happened here.

I think it just needs an exception handler around the regexp call

  def word_matches?(word, case_sensitive: false)
    options = case_sensitive ? nil : Regexp::IGNORECASE
    Regexp.new(WordWatcher.word_to_regexp(word), options).match?(@raw)
  end
2 Likes