Changeset 16260 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2020-04-11T17:37:01+02:00 (5 years ago)
Author:
simon04
Message:

fix #19070 - SearchCompiler: regexp comparison using <tilde>

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/search/PushbackTokenizer.java

    r12656 r16260  
    108108        EQUALS(marktr("<equals>")),
    109109        /**
     110         * The tilde sign (~)
     111         */
     112        TILDE(marktr("<tilde>")),
     113        /**
    110114         * A text
    111115         */
     
    148152    }
    149153
    150     private static final List<Character> SPECIAL_CHARS = Arrays.asList('"', ':', '(', ')', '|', '^', '=', '?', '<', '>');
     154    private static final List<Character> SPECIAL_CHARS = Arrays.asList('"', ':', '(', ')', '|', '^', '=', '~', '?', '<', '>');
    151155    private static final List<Character> SPECIAL_CHARS_QUOTED = Arrays.asList('"');
    152156
     
    200204            getChar();
    201205            return Token.EQUALS;
     206        case '~':
     207            getChar();
     208            return Token.TILDE;
    202209        case '<':
    203210            getChar();
  • trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java

    r16259 r16260  
    21192119            if (tokenizer.readIfEqual(Token.EQUALS)) {
    21202120                return new ExactKeyValue(regexSearch, key, tokenizer.readTextOrNumber());
     2121            } else if (tokenizer.readIfEqual(Token.TILDE)) {
     2122                return new ExactKeyValue(true, key, tokenizer.readTextOrNumber());
    21212123            } else if (tokenizer.readIfEqual(Token.LESS_THAN)) {
    21222124                return new ValueComparison(key, tokenizer.readTextOrNumber(), -1);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java

    r15292 r16260  
    294294                .addKeyword("<i>key</i>", null, tr("matches if ''key'' exists"))
    295295                .addKeyword("<i>key</i>=<i>value</i>", null, tr("''key'' with exactly ''value''"))
     296                .addKeyword("<i>key</i>~<i>regexp</i>", null, tr("value of ''key'' matching the regular expression ''regexp''"))
    296297                .addKeyword("<i>key</i>=*", null, tr("''key'' with any value"))
    297298                .addKeyword("<i>key</i>=", null, tr("''key'' with empty value"))
Note: See TracChangeset for help on using the changeset viewer.