User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions
Content added Content deleted
(→Functions: Translation code removal.) |
m (→Functions) |
||
Line 727: | Line 727: | ||
| <code>rcount</code> || Similar to <code>count</code> but the needle uses a regular expression instead.Can be made case-insensitive by letting the regular expression start with "(?i)".Please note that, for plain strings, this function can be up to 50 times slower than <code>count</code><ref>https://3v4l.org/S6IGP</ref>, so use that one when possible. |
| <code>rcount</code> || Similar to <code>count</code> but the needle uses a regular expression instead.Can be made case-insensitive by letting the regular expression start with "(?i)".Please note that, for plain strings, this function can be up to 50 times slower than <code>count</code><ref>https://3v4l.org/S6IGP</ref>, so use that one when possible. |
||
|- |
|- |
||
| <code>get_matches</code> || {{MW version-inline|MW 1.31+}} |
| <code>get_matches</code> || {{MW version-inline|MW 1.31+}} Looks for matches of the regex needle (first string) in the haystack (second string).Returns an array where the 0 element is the whole match and every <code>[n]</code> element is the match of the n'th capturing group of the needle.Can be made case-insensitive by letting the regular expression start with "(?i)".If a capturing group didn't match, that array position will take value of ''false''. |
||
|- |
|- |
||
| <code>ip_in_range</code> || |
| <code>ip_in_range</code> || Returns true if user's IP (first string) matches the specified IP range (second string, in [[:en:CIDR notation|CIDR notation]]).Only works for anonymous users. <translate><!--T:346--> Supports both IPv4 and IPv6 addresses.</translate> |
||
|- |
|- |
||
| <code>contains_any</code> || <translate><!--T:347--> Returns true if the first string contains '''any''' string from the following arguments (unlimited number of arguments in logic OR mode).</translate> <translate><!--T:348--> If the first argument is an array, it gets casted to string.</translate> |
| <code>contains_any</code> || <translate><!--T:347--> Returns true if the first string contains '''any''' string from the following arguments (unlimited number of arguments in logic OR mode).</translate> <translate><!--T:348--> If the first argument is an array, it gets casted to string.</translate> |