* wildcards in Watched Words (Censor) don't work

I’m sorry, but not so fast.

Watched Words Censor now works for words with wildcards.

However, it doesn’t work if watched_words_regular_expression is true.

I don’t think the censor function even considers it as regular expression at all.

Repo:

  1. Settings > watched words regular expression ==> ON
  2. Add xyz* to Censor
  3. In compose window, type xyz123
  4. See that it is censored as it is treating the * as a wildcard. If it is treated as a regular expression, xyz* should only match xy followed by a string of zzzz…

EDIT: The below is the culprit…

Notice that it is not even considering that the pattern may already be a regular expression.

Also,

This is always assuming that the pattern is a word pattern and \b pairs are auto-wrapped onto it. If the pattern is a regular expression, obviously the \b pairs can be omitted because the user should put them in himself.

إعجابَين (2)