In the Support category, user optimus asked if Discourse could censor specific text patterns, such as Social Security Numbers, beyond the standard word censoring found in site settings. codinghorror initially responded that the core software does not support wildcards or regular expressions for this purpose, noting that a plugin would be required. He explained that such a feature would necessitate the earlier implementation of hoisting code and pre blocks out of the processing pipeline to prevent regex patterns from matching inside code snippets [8]. downey added that this functionality would also help prevent accidental posting of full email addresses. optimus offered to help test the underlying work by zogstrip. Once the hoisting feature was completed, zogstrip clarified that optimus would need to write a custom plugin using Discourse.Dialect.addPreProcessor to implement the regex logic. Finally, codinghorror confirmed that support for wildcards in word censoring is now available, linking to a meta discussion for details.
Hi, I saw in Discourse that there is a way to censor words in admin/site_settings/category/posting - does anyone know of a way to censor specific patterns? For example, I foresee HR people eventually using the Discourse forum and to protect them from themselves posting sensitive info I want to automatically remove SSNs (i.e. XXX-XX-XXXX). Has anyone had this need before and found a way to do it?
Something like this would also be useful for the inclusion of full email addresses being discussed in other topics right now and caused by HTML email parsing bugs.