This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

JOSM Search function: Regex use and samples

1

I need some info how to use "regular expression" here. JOSM site is lacking help on this topic. For example what to enter in the search box to look for names starting with a particular string.

asked 01 Dec '15, 08:51

Plamen's gravatar image

Plamen
1516713
accept rate: 0%

edited 01 Dec '15, 10:43


One Answer:

4

First, you have to enable expert mode. Then just open the search tool and enable regular expression. Now you can enter regular expressions enclosed in quotes, like "^Park" for selecting any "Park Avenue", "Park Lane" and so on. According to this page JOSM uses Java Regex.

answered 01 Dec '15, 11:47

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

edited 01 Dec '15, 12:14

Thanks, name:"^Park" is OK, but also return name:en=Park when name=Something_else. Is it possible name:en:"^Park"?

(01 Dec '15, 13:03) Plamen
1

Oh, that's interesting. "name"="value" doesn't seem to work when using regular expressions for value. This could be a bug. However "^name$":"^Park" seems to perform an exact match and ignores keys with name:en, disused:name (bad example) and so on.

(01 Dec '15, 13:25) scai ♦

Source code available on GitHub .