User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions
User:松/Drafts/Extension:AbuseFilter/Rules format (view source)
Revision as of 13:53, 13 August 2020
, 3 years agoTranslation code removal.
(Translation code removal.) |
(Translation code removal.) |
||
Line 615:
<!--T:283-->
* Use <tvar|1><code>_pst</code></> variables when you're really sure that non-PST variables aren't enough.</translate> <translate><!--T:284--> You may also conditionally decide which one to check: if, for instance, you want to examine a signature, check first if <tvar|1><code>added_lines</code></> contains <tvar|2><code><nowiki>~~~</nowiki></code></>;</translate>
*
▲* In general, when dealing with these variables, it's always much better to consume further conditions but avoid computing heavy stuff.</translate> <translate><!--T:286--> In order to achieve this, always put heavy variables as last conditions.</translate>
▲<translate><!--T:287--> Last but not least, note that whenever a variable is computed for a given filter, it'll be saved and any other filter will immediately retrieve it.</translate>This means that one single filter computing this variable counts more or less as dozens of filters using it.
== Keywords ==
Line 626 ⟶ 625:
*<code>like</code> (or <code>matches</code>) returns true if the left-hand operand matches the [[w:Glob (programming)#Syntax|glob pattern]] in the right-hand operand.
*
*
*
The system uses [[w:Perl Compatible Regular Expressions|PCRE]].The only PCRE option enabled is <code>PCRE_UTF8</code> (modifier <code>u</code> [https://php.net/reference.pcre.pattern.modifiers in PHP]); for <code>irlike</code> both <code>PCRE_CASELESS</code> and <code>PCRE_UTF8</code> are enabled (modifier <code>iu</code>).
Line 663 ⟶ 662:
| <code> "o" in ["foo", "bar"]</code>
| True
|
|-
| <code>"foo" regex "\w+"</code>
Line 671 ⟶ 670:
| <code>"a\b" regex "a\\\\b"</code>
| True
| rowspan= "2" |
|-
| <code>"a\b" regex "a\x5C\x5Cb"</code>
|