This example incorporates common spamming keywords (some taken from Meta-Wiki's Spam Blacklist) and also techniques for blocking CSS hidden spam. Experiment with the $wg Spam Regex setting, and test out some edits on your Sand Box page, to see what gets blocked. The above example shows a regular expression being built up over several lines, using PHP's dot syntax to concatenate strings.This makes this long regular expression more compact, but also a bit more complicated.
It will not block all spam, but it can reduce spam dramatically, with almost no negative impact upon legitimate users.
$wg Spam Regex's configuration settings will control how mediawiki examines the text of contributions and determines if the contributions are spam or not.
Note that the second-to-last line does not have the "|" at the end of the string.
This is because the next line ends the regular expression with the closing wrapper / followed by the "i" switch. incorrectly matching legitimate edits, see AVOID FALSE POSITIVES! The setting which you assign to $wg Spam Regex, is a regular expression (See Wikipedia's article and PHP's manual on regular expressions).
Any text added to a wiki page matching this regular expression (or "regex") will be recognized as Wiki spam and the edit will be blocked.
$wg Spam Regex will affect all user groups; even members of the sysop and bureaucrats user groups will be disallowed saving a text, if it matches $wg Spam Regex.
Use Extension: Abuse Filter to be able to set up rules, which also allow you to filter by group!
$wg Spam Regex is one of Media Wiki's most effective built in anti-spam features.
The $wg Spam Regex is applied to all contributed text, including the spam link URLs.