<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><div><blockquote type="cite" class=""><blockquote type="cite" class="">  ajouter wikimedia_common serrait pratique<br class=""></blockquote><blockquote type="cite" class=""><div class=""></div></blockquote></blockquote></div><blockquote type="cite" class="">pour wikimedia_common cela ne teste que l'encodage %</blockquote><blockquote type="cite" class=""><div class=""><div class="">et non la présence d'une url complète <> id<br class=""></div></div></blockquote>Donc, ya plus ka 😉</div><div><br class=""></div><div><div><font face="Courier New" class="">*[wikimedia_commons =~ /%[0-9A-F][0-9A-F]/] {</font></div><div><font face="Courier New" class="">  throwError: tr("{0} tag should not have URL-encoded values like ''%27''", "{0.key}");</font></div><div><font face="Courier New" class="">  fixAdd: concat("wikimedia_commons=", trim(<b class="">replace</b>(URL_decode(tag("wikimedia_commons")), <b class="">"_"</b>, <b class="">" "</b>)));</font></div><div><font face="Courier New" class="">  assertMatch: "node wikimedia_commons=File:Foo%27s";</font></div><div><font face="Courier New" class="">  assertNoMatch: "node wikimedia_commons=File:Foo";</font></div><div><font face="Courier New" class="">}</font></div><div class=""><br class=""></div></div><div>Je note aussi que ce script décode les URL mais aussi remplace les «_» par des « ».</div><div>Il n’y a pas de règle qui détecte  «_» pour les clés wikipedia et wikimedia_commons (et c’est pénible à faire manuellement).</div><div><br class=""></div><div><blockquote type="cite" class=""><p class="">PanierAvide à écrit :</p></blockquote><blockquote type="cite" class=""><p class="">Normalement pas besoin de recharger le fichier dans la configuration de JOSM : le fait de relancer la validation suffit (il relit le fichier systématiquement).</p></blockquote>Merci 😀<br class=""><blockquote type="cite" class=""><p class=""> Pour la console c'est bien ça la question : le log qui peut apparaître quand on lance JOSM depuis l'invite de commande n'affiche pas ces erreurs.</p></blockquote>Zut.</div><div><br class=""></div><div>Du coup, je crois avoir trouvé comment utiliser regexp_match:</div><div><a href="https://josm.openstreetmap.de/browser/josm/trunk/data/validator/wikipedia.mapcss?order=name#L28" class="">https://josm.openstreetmap.de/browser/josm/trunk/data/validator/wikipedia.mapcss?order=name#L28</a></div><div><br class=""></div><div><span style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);" class="">fixAdd</span><span class="o" style="font-weight: bold; font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">:</span><span style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);" class=""> concat</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">(</span><span class="s2" style="color: rgb(187, 136, 68); font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">"wikipedia=be-tarask:"</span><span class="o" style="font-weight: bold; font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">,</span><span style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);" class=""> get</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">(</span><span style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);" class="">regexp_match</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">(</span><span class="s2" style="color: rgb(187, 136, 68); font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">"^be-x-old:(.+)$"</span><span class="o" style="font-weight: bold; font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">,</span><span style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);" class=""> tag</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">(</span><span class="s2" style="color: rgb(187, 136, 68); font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">"wikipedia"</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">))</span><span class="o" style="font-weight: bold; font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">,</span><span class="m" style="color: rgb(0, 153, 153); font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">1</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">));</span></div><div><br class=""></div><div><span style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);" class="">regexp_match</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">(</span><span class="s2" style="color: rgb(187, 136, 68); font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">"^be-x-old:(.+)$"</span><span class="o" style="font-weight: bold; font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">,</span><span style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);" class=""> tag</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">(</span><span class="s2" style="color: rgb(187, 136, 68); font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">"wikipedia »</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">))</span> renvoi le tableau avec les correspondances</div><div><span style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);" class="">get</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">(xxxx</span><span class="o" style="font-weight: bold; font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">,</span><span class="m" style="color: rgb(0, 153, 153); font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">1</span><span class="p" style="font-family: monospace; font-size: 11px; background-color: rgb(238, 238, 221);">)</span> renvoi la première correspondance (0 pour la chaine complète)<br class=""><blockquote type="cite" class=""><p class="">La syntaxe des fonctions est en MapCSS, mais l'interprétation de ces fonctions se fait sans doute en Java.<br class=""></p></blockquote><div class=""><p class=""><br class=""></p></div></div><div>—</div><div>Yves</div><br class=""></body></html>