Changeset 17746 in josm for trunk/src


Ignore:
Timestamp:
2021-04-11T13:09:44+02:00 (4 years ago)
Author:
simon04
Message:

fix #16171 - Case sensitive regexp key=value searches aren't case sensitive

File:
1 edited

Legend:

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

    r17585 r17746  
    898898         * Constructs a new {@code ExactKeyValue}.
    899899         * @param regexp regular expression
     900         * @param caseSensitive {@code true} to perform a case-sensitive search
    900901         * @param key key
    901902         * @param value value
    902903         * @throws SearchParseError if a parse error occurs
    903904         */
    904         public ExactKeyValue(boolean regexp, String key, String value) throws SearchParseError {
     905        public ExactKeyValue(boolean regexp, boolean caseSensitive, String key, String value) throws SearchParseError {
    905906            if ("".equals(key))
    906907                throw new SearchParseError(tr("Key cannot be empty when tag operator is used. Sample use: key=value"));
     
    938939
    939940            if (regexp && !key.isEmpty() && !"*".equals(key)) {
    940                 keyPattern = compilePattern(key, regexFlags(false));
     941                keyPattern = compilePattern(key, regexFlags(caseSensitive));
    941942            } else {
    942943                keyPattern = null;
    943944            }
    944945            if (regexp && !this.value.isEmpty() && !"*".equals(this.value)) {
    945                 valuePattern = compilePattern(this.value, regexFlags(false));
     946                valuePattern = compilePattern(this.value, regexFlags(caseSensitive));
    946947            } else {
    947948                valuePattern = null;
     
    21022103            String key = tokenizer.getText();
    21032104            if (tokenizer.readIfEqual(Token.EQUALS)) {
    2104                 return new ExactKeyValue(regexSearch, key, tokenizer.readTextOrNumber());
     2105                return new ExactKeyValue(regexSearch, caseSensitive, key, tokenizer.readTextOrNumber());
    21052106            } else if (tokenizer.readIfEqual(Token.TILDE)) {
    2106                 return new ExactKeyValue(true, key, tokenizer.readTextOrNumber());
     2107                return new ExactKeyValue(true, caseSensitive, key, tokenizer.readTextOrNumber());
    21072108            } else if (tokenizer.readIfEqual(Token.LESS_THAN)) {
    21082109                return new ValueComparison(key, tokenizer.readTextOrNumber(), -1);
Note: See TracChangeset for help on using the changeset viewer.