I don’t know if anyone actually uses this for other than fun but due to inflection it would be nice to be able to use wildcards when adding censored words.
AI-generated summary
The discussion revolves around adding support for wildcards in word censoring, specifically using regular expressions. riking notes the feature was intentionally avoided to prevent misuse, while downey and codinghorror express concerns about the risks of regex, especially for non-experts. neil announces a new regex-based censorship setting, providing an example for filtering phone numbers. Mittineague suggests regex can be useful for limited cases like table names, but warns against misuse. boxels asks about guidance for beginners, and Mittineague recommends using regex101.com for learning. pfaffman asks about multiple regex patterns, and DeanMarkTaylor shares a working regex for emails and phone numbers. riking cautions against censoring words like “admin” to avoid issues. easylocarb and codinghorror highlight how easily regex can be bypassed. pfaffman confirms the new feature is now available at /admin/word_censoring.
Hey look what we added this week:
This is a new setting that works alongside censored words, but is a regular expression. The above example filters 7 digits of a phone number. If you like it, call me at 555-1234!
The value entered in the setting is checked to see if it matches too greedily like (.)*. Also, if cooking a post ever fails because the javascript engine timed out, then the censored pattern setting will be cleared on the assumption that it’s an evil regex like (a|aa)+.
Anyone have any guidance on newbies using regex patterns? Can you do more than one? does a list like this work, if so how do we enter it to make each word work?
Can there be more than one regex? It doesn’t seem to let you have multiples like permalink normalizations, for example.
I’ve a client who’d like phone numbers and emails hidden.
Edit: No, but you don’t need that, just use a |.
\d{3}-\d{4}|[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+ will censor email addresses and xxx-yyyy phone numbers.
This is now at /admin / logs /watched words /censor
