<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>Bonjour,</div><div><br class=""><blockquote type="cite" class=""><div class="">Le 3 nov. 2019, PanierAvide a écrit :</div><br class="Apple-interchange-newline"><div class=""><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Sur le modèle du fichier MapCSS pour les tags Wikimedia, on peut ajouter une règle avec un "regexp_match" pour rechercher/remplacer automatiquement. Pour une raison qui m'échappe, la règle suivante qui devrait faire le boulot ne fonctionne pas (pour tester, créer un nœud avec le tag mapillary=<a class="moz-txt-link-freetext" href="https://www.mapillary.com/app/?lat=49.18298900000002&lng=-2.1090169999999944&z=17&pKey=XCcwknc5F9zgqs6GKBUFig">https://www.mapillary.com/app/?lat=49.18298900000002&lng=-2.1090169999999944&z=17&pKey=XCcwknc5F9zgqs6GKBUFig</a><span class="Apple-converted-space"> </span>) :<br class=""></p><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><code class="">*[mapillary][mapillary!~/^[a-zA-Z0-9_-]{22}$/][mapillary=~/pKey=[a-zA-Z0-9_-]{22}/] {</code><code class=""><br class=""></code><code class=""> throwError: tr("mapillary tag should only contain image ID instead of full URL");</code><code class=""><br class=""></code><code class=""> fixAdd: concat("mapillary=", get(regexp_match("pKey=([a-zA-Z0-9_-]{22})", tag("mapillary")),1));</code><code class=""><br class=""></code><code class="">}</code></p><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Si un expert JOSM/MapCSS peut nous éclairer là-dessus... :-)</p><div class=""><br class=""></div></div></blockquote>En fait, c’est comme si il manquait le flag « g ».</div><div>L’expression « <b class="">pKey=(.*)</b> » ne fonctionne pas, mais « <b class="">.*pKey=(.*).* </b>» oui !!</div><div><br class=""></div><div>La <a href="https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation" class="">doc</a> parle de flag i, m ou s.</div><div><span style="background-color: rgb(255, 255, 255);" class=""><font face="Verdana, Arial, Bitstream Vera Sans, Helvetica, sans-serif" size="2" class="">Flags is a string that may contain "i" (case insensitive), "m" (multiline) and "s" ("dot all »)</font></span></div><div><span style="background-color: rgb(255, 255, 255);" class=""><font face="Verdana, Arial, Bitstream Vera Sans, Helvetica, sans-serif" size="2" class="">Idem pour </font></span><a href="https://josm.openstreetmap.de/doc/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.html#regexp_match-java.lang.String-java.lang.String-java.lang.String-" class="">Javadoc</a></div><div><br class=""></div><div>Il y a plus de flags décrit <a href="https://josm.openstreetmap.de/doc/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.html#regexp_match-java.lang.String-java.lang.String-java.lang.String-" class="">ici</a> : </div><dl style="caret-color: rgb(53, 56, 51); color: rgb(53, 56, 51); font-family: "DejaVu Sans", Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class=""><dd style="margin: 5px 0px 10px; font-family: "DejaVu Sans Mono", monospace;" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">flags</code> - Match flags, a bit mask that may include <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#CASE_INSENSITIVE" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">CASE_INSENSITIVE</code></a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#MULTILINE" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">MULTILINE</code></a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#DOTALL" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">DOTALL</code></a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#UNICODE_CASE" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">UNICODE_CASE</code></a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#CANON_EQ" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">CANON_EQ</code></a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#UNIX_LINES" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">UNIX_LINES</code></a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#LITERAL" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">LITERAL</code></a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#UNICODE_CHARACTER_CLASS" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">UNICODE_CHARACTER_CLASS</code></a> and <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#COMMENTS" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">COMMENTS</code></a></dd></dl><div class="">Le flag g de Perl est implicite d’après la doc :</div><div class=""><ul style="caret-color: rgb(71, 71, 71); color: rgb(71, 71, 71); font-family: "DejaVu Serif", Georgia, "Times New Roman", Times, serif; font-size: 14px;" class=""><li class=""><p class="">Perl uses the <tt style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">g</tt> flag to request a match that resumes where the last match left off. This functionality is provided implicitly by the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html" title="class in java.util.regex" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">Matcher</code></a> class: Repeated invocations of the <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html#find--" style="text-decoration: none; color: rgb(74, 103, 130);" class=""><code style="font-family: "DejaVu Sans Mono", monospace; padding-top: 4px; margin-top: 8px; line-height: 1.4em;" class="">find</code></a> method will resume where the last match left off, unless the matcher is reset.</p></li></ul><div class="">C’est comme si l’expression régulière était évaluée différemment par regexp_match et MapCSS ??</div></div><div class=""><br class=""></div><div class="">—</div><div class="">Yves</div><div class=""><br class=""></div></body></html>