• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Advanced Censoring (Post Content Replacement) [Deleted]

farang

Well-known member
#1
farang submitted a new resource:

Advanced Censoring (Post Content Replacement) - Censoring posts using regular expressions. Helps prevent spam.

XenForo has a nice built in function to censor words when displaying messages. Unlike the XenForo word censoring function, the replacements made by this versatile add-on is permanently committed into posted messages. The replacement is occurring at the moment when someone makes a post.

The benefits of using a regular expression instead of a fixed word is that the possibilities are vast. A regular expression is a compact way of describing sets of strings which conform to a pattern.

For...
Read more about this resource...
 
Last edited:

farang

Well-known member
#4
that you farang

it works also while editing?
Yes it's supposed to recensor the post if it's edited. ;-)

It will not do anything if you just edit and save (without making any actual changes) . If You edit and change something the post will be recensored when you save it.
 
Last edited:

farang

Well-known member
#5
This morning I was experimenting a bit with some more matching patterns.

Suppose you want to replace a word but the poster has been inventive enough to spell it a bit differently than conventional. In the example below we have used the word biagra. It's just an example how Advanced Censoring could be used if you wanted to. Nothing else.
As always use two comma separated and "-enclosed strings on a single line

Code:
# Find biagra, biaaggggra, bia gra, bia.gra, \/|AGRA, \/I/\GR/\, b1aqra, bi@gr@ and other variants:
"/[vb\\]+\/?.?[i:1!\|]+.?[a@\/]+\\?.?[gq]+.?r+.?[a@\/]+\\?/i", "[Replaced]"
I used to validate rexex at http://regexr.com/ but I have found https://regex101.com/ much better since it uses PCRE regular expressions.

P.S. The ending of the string "i" is a modifier that makes the comparison case insensitive. The "g" modifier is implicit with preg_replace(), you shouldn't include it.
 
Last edited:

farang

Well-known member
#10
If you have some spare time, I'd love to have some feedback (and possible also a review) from you guys using this add-on. Ideas for improvements are also appreciated. Thanks and happy holidays! ;)