| 1 |
/* Examples from [[mw:Extension:AbuseFilter/Rules format#Functions]] */ |
| 2 |
|
| 3 |
length( "Wikipedia" ) === 9 & |
| 4 |
lcase( "WikiPedia" ) === 'wikipedia' & |
| 5 |
ccnorm( "w1k1p3d14" ) === 'WIKIPEDIA' & |
| 6 |
ccnorm( "ωɨƙɩᑭƐƉ1α" ) === 'WIKIPEDIA' & |
| 7 |
ccnorm_contains_any( "w1k1p3d14", "wiKiP3D1A", "foo", "bar" ) === true & |
| 8 |
ccnorm_contains_any( "w1k1p3d14", "foo", "bar", "baz" ) === false & |
| 9 |
ccnorm_contains_any( "w1k1p3d14 is 4w3s0me", "bar", "baz", "some" ) === true & |
| 10 |
ccnorm( "ìíîïĩїį!ľ₤ĺľḷĿ" ) === 'IIIIIII!LLLLLL' & |
| 11 |
norm( "!!ω..ɨ..ƙ..ɩ..ᑭᑭ..Ɛ.Ɖ@@1%%α!!" ) === 'WIKIPEDAIA' & |
| 12 |
norm( "F00 B@rr" ) === 'FOBAR' & |
| 13 |
rmdoubles( "foobybboo" ) === 'fobybo' & |
| 14 |
specialratio( "Wikipedia!" ) === 0.1 & |
| 15 |
count( "foo", "foofooboofoo" ) === 3 & |
| 16 |
count( "foo,bar,baz" ) === 3 & |
| 17 |
rmspecials( "FOOBAR!!1" ) === 'FOOBAR1' & |
| 18 |
rescape( "abc* (def)" ) === 'abc\* \(def\)' & |
| 19 |
str_replace( "foobarbaz", "bar", "-" ) === 'foo-baz' & |
| 20 |
ip_in_range( "127.0.10.0", "127.0.0.0/12" ) === true & |
| 21 |
contains_any( "foobar", "x", "y", "f" ) === true & |
| 22 |
get_matches( "(foo?ba+r) is (so+ good)", "fobaaar is soooo good to eat" ) === ['fobaaar is soooo good', 'fobaaar', 'soooo good'] |