[josm-dev] [PATCH] Regex support for search
Ævar Arnfjörð Bjarmason
avarab at gmail.com
Thu Jan 8 13:59:34 GMT 2009
The attached patch adds regex support to search, this solves trac
ticket #1864 , it adds a new "regex search" checkbox to the
search dialog below "case sensitive". If it's checked the pattern
given will be compiled as a regex with java.util.regex, e.g.:
^hig.*?[way]+$ # Matches in both keys and values
^foo$:[bar] # Seperate regexes for the key and value
Patterns are case-insensitive by default, if the "case sensitive"
checkbox is checked they will be compiled with
Pattern.CASE_INSENSITIVE set (instead of lower casing the regex or
pattern which would screw things up).
If the user enters an invalid regex a dialog like this (by throwing
ParseError) shows up:
It is of course translatable but the "full error" part comes directly
from Java's e.getMessage() exception method and may thus not be in the
same language as the rest of the JOSM interface. Although Java
implementations might have it localized. I think this is acceptable
given the limitations, the alternative is to provide a "regex
compilation failed" error without any further detail.
2. I couldn't submit it to trac, it gave me: "500 Internal Server
Error (Submission rejected as potential spam (Content contained
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 14910 bytes
Desc: not available
More information about the josm-dev