Knowledge

:Edit filter/Instructions - Knowledge

Source 📝

103: 244:
Because these filters are run on every single edit, a poorly worded filter has the strong potential to severely slow down editing or even cause some larger pages to time out. However, some very minor changes in how the conditions are ordered can greatly decrease the running time of the filters.
407:
You should always order your filters so that the condition that will knock out the largest number of edits is first. Usually this is a user groups or a user editcount check; in general, the last condition should be the regex that is actually looking for the sort of vandalism you're targeting.
235:
that the filter will not cause mass unexpected disruption or flood the edit filter log with erroneous entries and actions, you can fully enable your filter by adding a warning, disallow action, or tag.
253:
Operations are generally done left-to-right, but there is an order to which they are resolved. As soon as the filter fails one of the conditions, it will stop checking the rest of them (due to
111:
are very powerful tools - do not underestimate the damage errors can cause. If you're new to this, make sure you get appropriate input from editors more experienced with edit filters.
173:
Find someone who recently made an edit that you're trying to target, add that account's username or user IP address to the "Changes by user" text field, and click on "Test".
245:
Making use of the order of operations in this way can make the difference between a good filter and one that must be disabled for performance reasons.
228:, so that other edit filter managers can have a chance to examine the filter, post feedback and suggestions, or improve the code themselves. 371: 72: 131: 82: 392:
have the tendency to be very large. Sometimes you will be able to approximate these variables by using smaller ones such as
62: 388:, the filter must go through the entire string variable to look for the string you're searching for. Variables such as 57: 217:
Let the idle filter run for a while to test for hits that are false positives, or misses that are false negatives.
77: 186:
Find the edit that you targeted and click on "(details)" Check the variables - are they the values you expected?
420: 122:
This section explains how to create a filter and conduct some preliminary testing, so that you don't flood the
183:
Tick the "show changes that do not match the filter" checkbox to enable the setting, and click "Test" again.
123: 248: 190: 137: 254: 163: 204: 404:
can also help to ensure that you're not going to even try checking a large block of wikitext.
108: 52: 17: 8: 35: 239: 214:
In the notes field, add a description such as "Testing phase, will add a warning".
87: 414: 225: 117: 42: 400:, which the filter can process much faster. Also, using a check for 272:
Turning variables/literals into their respective data. (i.e.,
231:
Finally, after you have performed extensive testing and are
257:) and move on to the next filter. The evaluation order is: 326:
Multiplication-related (multiplication, division, modulo)
151:to test your regexp - true expressions evaluate to 412: 298:(defining positive or negative value, e.g. 162:Manually test your code on the edit filter 193:page to troubleshoot your code, if needed. 180:If you don't see positive trigger hits: 130:Read the filter rules documentation at 14: 413: 207:an "idle" (logging only) edit filter. 132:mw:Extension:AbuseFilter/Rules format 261:Anything surrounded by parentheses ( 97: 25: 372:Making expensive operations cheaper 23: 24: 432: 136:Test some regular expressions at 269:) is evaluated as a single unit. 101: 149:'some string' rlike 'myregexp' 13: 1: 376:When using keywords such as 7: 10: 437: 329:Addition and subtraction ( 155:, false will show nothing. 226:edit filters' noticeboard 83:Reporting false positives 255:short-circuit evaluation 240:Controlling efficiency 224:Post a message on the 147:For example, evaluate 78:Requested edit filters 68:How to create a filter 36:Edit filter management 421:Knowledge edit filter 351:Boolean operations. ( 18:Knowledge:Edit filter 312:Boolean inversion ( 249:Order of operations 88:Tags documentation 73:Traps and pitfalls 274:article_namespace 118:Creating a filter 115: 114: 96: 95: 428: 366: 362: 358: 354: 347: 343: 339: 332: 322: 319:Exponentiation ( 315: 305: 301: 297: 293: 286: 282: 279:Function calls ( 275: 268: 264: 150: 105: 104: 98: 26: 436: 435: 431: 430: 429: 427: 426: 425: 411: 410: 374: 364: 360: 356: 352: 345: 341: 337: 330: 320: 313: 303: 299: 295: 291: 284: 280: 273: 266: 262: 251: 242: 191:debugging tools 148: 138:debugging tools 120: 102: 92: 48: 43:Tags management 22: 21: 20: 12: 11: 5: 434: 424: 423: 403: 399: 395: 391: 387: 383: 379: 373: 370: 369: 368: 349: 336:Comparisons. ( 334: 327: 324: 317: 310: 307: 288: 277: 270: 250: 247: 241: 238: 237: 236: 229: 221: 220: 219: 218: 215: 209: 208: 201: 200: 199: 198: 197: 196: 195: 194: 189:Return to the 187: 184: 175: 174: 168: 167: 159: 158: 157: 156: 154: 142: 141: 134: 119: 116: 113: 112: 106: 94: 93: 91: 90: 85: 80: 75: 70: 65: 60: 55: 49: 47: 46: 39: 31: 29: 15: 9: 6: 4: 3: 2: 433: 422: 419: 418: 416: 409: 405: 401: 398:removed_lines 397: 393: 389: 385: 381: 377: 350: 335: 328: 325: 318: 311: 308: 289: 278: 271: 260: 259: 258: 256: 246: 234: 230: 227: 223: 222: 216: 213: 212: 211: 210: 206: 203: 202: 192: 188: 185: 182: 181: 179: 178: 177: 176: 172: 171: 170: 169: 165: 164:batch testing 161: 160: 152: 146: 145: 144: 143: 139: 135: 133: 129: 128: 127: 125: 110: 107: 100: 99: 89: 86: 84: 81: 79: 76: 74: 71: 69: 66: 64: 63:Documentation 61: 59: 56: 54: 51: 50: 45: 44: 40: 38: 37: 33: 32: 30: 28: 27: 19: 406: 390:old_wikitext 375: 252: 243: 232: 124:history page 121: 109:Edit filters 67: 41: 34: 394:added_lines 58:Noticeboard 53:Edit filter 415:Category 402:old_size 386:contains 321:2**3 → 8 309:Keywords 331:3-2 → 1 287:, etc.) 233:certain 290:Unary 205:Create 384:, or 378:rlike 353:& 342:: --> 304:+1234 300:-1234 285:lcase 276:to 0) 166:page: 16:< 338:< 294:and 281:norm 265:and 396:or 417:: 382:in 380:, 365:in 363:, 359:, 355:, 346:== 344:, 340:, 314:!x 302:, 283:, 126:. 367:) 361:^ 357:| 348:) 333:) 323:) 316:) 306:) 296:- 292:+ 267:) 263:( 153:1 140::

Index

Knowledge:Edit filter
Edit filter management
Tags management
Edit filter
Noticeboard
Documentation
How to create a filter
Traps and pitfalls
Requested edit filters
Reporting false positives
Tags documentation
Edit filters
history page
mw:Extension:AbuseFilter/Rules format
debugging tools
batch testing
debugging tools
Create
edit filters' noticeboard
short-circuit evaluation
Category
Knowledge edit filter

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.