Commons:File description page regular expressions/XML
Jump to navigation
Jump to search
Paste the code below into your AWB XML file, between the <Replacements> tag to add these regular expressions to your bot.
<Replacement> <Find>^==[ ]*(summary|sumario|descri(ption|pción|ção do arquivo)|achoimriú)([ ]*/[ ]*(summary|sumario|descri(ption|pción|ção do arquivo)|achoimriú))?[ ]*==</Find> <Replace>== {{int:filedesc}} ==</Replace> <Comment>"Summary" heading</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase Multiline </RegularExpressionOptions> </Replacement> <Replacement> <Find>^==[ ]*(\[\[.*?\|)?(licen[cs](e|ing|ia)([ ]*/[ ]*licen[cs](e|ing|ia))?|\{\{int:license-header\}\})(\]\])?:?[ ]*==</Find> <Replace>== {{int:license}} ==</Replace> <Comment>"Licensing" heading</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase Multiline </RegularExpressionOptions> </Replacement> <Replacement> <Find>^==[ ]*(original upload (log|history)|file history|ursprüngliche bild-versionen)[ ]*==</Find> <Replace>== {{original upload log}} ==</Replace> <Comment>"Original upload log" heading</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase Multiline </RegularExpressionOptions> </Replacement> <Replacement> <Find>^[ ]*==[ ]*(.*?)[ ]*==[ ]*[\r\n]+[ ]*==[ ]*\1[ ]*==[ ]*$</Find> <Replace>== $1 ==</Replace> <Comment>Remove duplicate headings; Run multiple times</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase Multiline </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*(?:author|artist)[ ]*=[ ]*)(?:unknown|\?+)\.?[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1{{unknown}}$2</Replace> <Comment>{{tl|unknown}}</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*source[ ]*=[ ]*)(?:own work)?[ ]*(?:-|;|</?br[ ]*[/\\]?>)?[ ]*(?:own(?: work(?: by uploader)?)?|(?:œuvre |travail )?personnel(?:le)?|self[- ]made|création perso|selbst fotografiert|obra pr[òo]pia|trabajo propr?io)[ ]*(?:\(own work\))?\.?[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1{{own}}$2</Replace> <Comment>{{tl|own}} (part 1)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*source[ ]*=[ ]*)(?:\{\{[a-z]{2,3}[ ]*\|)?[ ]*(?:own(?: work(?: by uploader)?|travail personnel|self[- ]made|création perso|selbst fotografiert|obra pr[òo]pia|trabajo propr?io)[ ]*(?:\}\})?[ ]*(?:\{\{[a-z]{2,3}[ ]*\|)?[ ]*(?:\(?(?:own[ ]*work)\)?)?[ ]*(?:\}\})?(\||\}\}|\r|\n)</Find> <Replace>$1{{own}}$2</Replace> <Comment>{{tl|own}} (part 2)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*author[ ]*=[ ]*)(?:anonym(?:e|ous)?|anonyymi|anoniem|an[oòóô]nimo?|ismeretlen|不明(匿名)|미상|ανώνυμος|аноним(?:ен|ный художник)|neznámy|nieznany)\.?[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1{{anonymous}}$2</Replace> <Comment>{{tl|anonymous}}; -</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*technique[ ]*=[ ]*)(?:\{\{[ ]*(?:en|de)[ ]*\|)?[ ]*(?:oil[ -]on[ -]canvas|öl[ -]auf[ -]leinwand)[ ]*(?:\}\})?(\||\}\}|\r|\n)</Find> <Replace>$1{{technique|oil|canvas}}$2</Replace> <Comment>Oil on canvas</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*technique[ ]*=[ ]*)\{\{[ ]*de[ ]*\|[ ]*öl[ -]auf[ -]holz[ ]*\}\}(\||\}\}|\r|\n)</Find> <Replace>$1{{technique|oil|wood}}$2</Replace> <Comment>Oil on wood</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*technique[ ]*=[ ]*)\{\{[ ]*de[ ]*\|[ ]*öl[ -]auf[ -]eichenholz[ ]*\}\}(\||\}\}|\r|\n)</Find> <Replace>$1{{technique|oil|panel|wood=oak}}$2</Replace> <Comment>Oil on oak</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*technique[ ]*=[ ]*)(?:\{\{[ ]*en[ ]*\|)?[ ]*oil[ -]on[ -]panel[ ]*(?:\}\})?(\||\}\}|\r|\n)</Find> <Replace>$1{{technique|oil|panel}}$2</Replace> <Comment>Oil on panel</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*technique[ ]*=[ ]*)\{\{[ ]*de[ ]*\|[ ]*aquarell[ ]*\}\}(\||\}\}|\r|\n)</Find> <Replace>$1{{technique|watercolor}}$2</Replace> <Comment>Watercolor</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*technique[ ]*=[ ]*)\{\{[ ]*de[ ]*\|[ ]*fresko[ ]*\}\}(\||\}\}|\r|\n)</Find> <Replace>$1{{technique|fresco}}$2</Replace> <Comment>Fresco</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*description[ ]*=)[ ]*(?:\{\{[ ]*description missing[ ]*\}\}|(?:\{\{en[ ]*\|)?[ ]*(?:'')?no original description(?:'')?[ ]*(?:\}\})?)[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1$2</Replace> <Comment>"Description" cleanup</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*permission[ ]*=)[ ]*(?:-|see(?: licens(?:e|ing))?(?: below)?|yes|oui)\.?[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1$2</Replace> <Comment>"Permission" cleanup</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*other[_ ]versions[ ]*=)[ ]*(?:<i>)?(?:-|no|none?(?: known)?)\.?(?:</i>)?[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1$2</Replace> <Comment>"Other versions" cleanup</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*date[ ]*=[ ]*)(?:created|made|taken)?[ ]*([0-9]{4})(-| |/|\.|)(0[1-9]|1[0-2])\3(1[3-9]|2[0-9]|3[01])(\||\}\}|\r|\n)</Find> <Replace>$1$2-$4-$5$6</Replace> <Comment>Conversion (yyyy[ -/.]mm[ -/.]dd)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*date[ ]*=[ ]*)(?:created|made|taken)?[ ]*([0-9]{4})(-| |/|\.|)(1[3-9]|2[0-9]|3[01])\3(0[1-9]|1[0-2])(\||\}\}|\r|\n)</Find> <Replace>$1$2-$5-$4$6</Replace> <Comment>Conversion (yyyy[ -/.]dd[ -/.]mm)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*date[ ]*=[ ]*)(?:created|made|taken)?[ ]*(0[1-9]|1[0-2])(-| |/|\.|)(1[3-9]|2[0-9]|3[01])\3([0-9]{4})(\||\}\}|\r|\n)</Find> <Replace>$1$5-$2-$4$6</Replace> <Comment>Conversion (mm[ -/.dd[ -/.]yyyy)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*date[ ]*=[ ]*)(?:created|made|taken)?[ ]*(1[3-9]|2[0-9]|3[01])(-| |/|\.|)(0[1-9]|1[0-2])\3([0-9]{4})(\||\}\}|\r|\n)</Find> <Replace>$1$5-$4-$2$6</Replace> <Comment>Conversion (dd[ -/.]mm[ -/.]yyyy)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*date[ ]*=[ ]*)(?:created|made|taken)?[ ]*\{\{date\|([0-9]{4})\|(0[1-9]|1[012])\|(0?[1-9]|1[0-9]|2[0-9]|3[01])\}\}(\||\}\}|\r|\n)</Find> <Replace>$1$2-$3-$4$5</Replace> <Comment>Conversion ({{tlf|date|yyyy|mm|dd}}); {{tl|date}} function is built-in</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*(?:date|year)[ ]*=[ ]*)(\d\d?)(?:st|nd|rd|th)[ ]*century[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1{{other date|century|$2}}$3</Replace> <Comment>{{tlp|other date|century}}</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*(?:date|year)[ ]*=[ ]*)(?:cir)?ca?\.?[ ]*(\d{4})[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1{{other date|~|$2}}$3</Replace> <Comment>{{tlp|other date|~}}</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*(?:date|year)[ ]*=[ ]*)(?:unknown|\?+)\.?[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1{{other date|?}}$2</Replace> <Comment>{{tlp|other date|?}}</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\|[ ]*date[ ]*=[ ]*)(?:\{\{date\|)?([0-9]{4})[|-](0[1-9]|1[012])[|-](0[1-9]|1[0-9]|2[0-9]|3[01])(?:\}\})?[ ]*\((original upload date|according to EXIF data)\)[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1{{$5|$2-$3-$4}}$6</Replace> <Comment>{{tl|original upload date}} & {{tl|according to EXIF data}}</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(<!--)?[ ]*{\{ImageUpload\|(full|basic)\}\}[ ]*(-->)?[ ]*\n?</Find> <Replace></Replace> <Comment>{{tl|ImageUpload}} removal</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>true</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>[ ]*<!--[ ]*Remove this line once you have added categories[ ]*-->[ ]*</Find> <Replace></Replace> <Comment>Uncategorized comment; Usually left behind after categorizing</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>true</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>[ ]*<!--[ ]*categories[ ]*-->[ ]*\n?</Find> <Replace></Replace> <Comment>"Categories" comment</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>true</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>__[ ]*NOTOC[ ]*__</Find> <Replace></Replace> <Comment>Unnecessary __NOTOC__; Common.css prevents file pages from showing TOCs</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>true</Minor> <RegularExpressionOptions> </RegularExpressionOptions> </Replacement> <Replacement> <Find>\{\{en[ ]*(?:\|[ ]*1=)?[ ]*\}\}[ ]*(\||\}\}|\r|\n)</Find> <Replace>$1</Replace> <Comment>Remove empty lang templates; Ignores those followed by text <small>(incorrect usage but still indicates the language)</small></Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>\[http://([a-z0-9\-]{2,3})\.(?:(w)ikipedia|(wikt)ionary|wiki(n)ews|wiki(b)ooks|wiki(q)uote|wiki(s)ource|wiki(v)ersity)\.(?:com|net|org)/wiki/([^][{|}\s"]*) +([^\n\]]+)\]</Find> <Replace>[[$2$3$4$5$6$7$8:$1:$9|$10]]</Replace> <Comment>External to interwiki (part 1)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>\[http://(?:(m)eta|(incubator)|(quality))\.wikimedia\.(?:com|net|org)/wiki/([^][{|}\s"]*) +([^\n\]]+)\]</Find> <Replace>[[$1$2$3:$4|$5]]</Replace> <Comment>External to interwiki (part 2)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>\[http://commons\.wikimedia\.(?:com|net|org)/wiki/([^][{|}\s"]*) +([^\n\]]+)\]</Find> <Replace>[[:$1|$2]]</Replace> <Comment>External to wikilink (local)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>[ ]*\[\[category[ ]*:[ ]*([^]]*?)[ ]*(\|[^]]*)?\]\][ ]*</Find> <Replace>[[Category:$1$2]]</Replace> <Comment>Normalize categories; Run this before the other category fixes</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>\[\[category: *\]\](?:\n( *\[\[category:))?</Find> <Replace>$1</Replace> <Comment>Remove empty [[Category:]]</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>\[\[category:([^]]+)\]\]\[\[category:([^]]+)\]\]</Find> <Replace>[[Category:$2]]\n[[Category:$3]]</Replace> <Comment>One category per line; Run multiple times</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\[\[category:)([^]]+\]\])(.*?)\1\2\n?</Find> <Replace>$1$2$3</Replace> <Comment>Remove duplicates; Run multiple times</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\[\[category:[^]]+\]\]\n)\n+(\[\[category:)</Find> <Replace>$1$2</Replace> <Comment>Remove blank lines between categories</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>\n{3,}</Find> <Replace>\n\n</Replace> <Comment>Delete surplus lines</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find></?br( )?(/)?\\?></Find> <Replace><br$1$2></Replace> <Comment>Fix incorrect line break syntax; This fixes only incorrect syntax (so <br>, <br/>, and <br /> are preserved)</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>(\{\{\}\}|\[\[\]\]|<gallery></gallery>|\[\[:?File[ ]*:[ ]*\]\]|)</Find> <Replace></Replace> <Comment>Remove {{}}, [[]], <gallery></gallery>, etc.</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement> <Replacement> <Find>\b(class[ ]*=[ ]*)("[^"]*)?prettytable([^"]*")?</Find> <Replace>$1$2wikitable$3</Replace> <Comment>prettytable → wikitable</Comment> <IsRegex>true</IsRegex> <Enabled>true</Enabled> <Minor>false</Minor> <RegularExpressionOptions> IgnoreCase </RegularExpressionOptions> </Replacement>