JOSM Regex Search for Names beginning with numbers

I’m having great difficulty getting a regex expression to work. I’ve tried several ways and not getting the results I want.

I want a filter that will give me all ways with a name beginning with a number. It would be great if it returned any highways with names beginning with a number, but even just ways would work.

So far I’m enabled expert mode and tried
type:way ^name$~^/D
type:way ^name$~^/b[0-9
type:way name~^/b[0-9]

Nothing is giving me the results I want. I’ll be the first to admit that my regex skills really really suck.

Can anyone help?

I don’t use regular expressions often but one resource that’s been useful to me is the Online Regex Tester

My first shot at what you want is the regex string: ^[0-9]*.

Check this page out: https://regex101.com/ The Online Regex Tester is very helpful in getting the syntax right.

Arranging the regex string to work within a query is also tricky. You’ll have to experiment with it to get results.

1 Like

Did not try, my first guess would be name~“^[0-9]+.*”

Works, so, your filter should be

type:way highway=* name~"^[0-9]+.*"
1 Like

That is AWESOME. Thank you so much!

That’ll make my life a lot easier fixing some road names in national forests.

That helped me too. Thanks!

Helped me too, tks
and for the Overpass Turbo Query Wizard http://overpass-turbo.eu/
type:way and highway=* and name~“^[0-9]+."
or for checking nodes, ways and relations…
highway=
and name~”^[0-9]+.*"

Hi. The documentation is not clear enough. Seems that the support of java regex pattern is not 100% compatible.

Each key=value is a line? (see my last example)
How do you specify a that the element must match some regex for the key and some other regex for the value? (seems to be write them separated by “:”)

E.g. to search for housenumbers with two digits, the \d{2} does not work, \d\d also doesn’t work, but i have success specifiyng digits with [0-9].

“^addr:housenumber$”:“[1][0-9]$”


  1. 0-9 ↩︎

Try "^addr:housenumber$":"^\\d{2}$". It seems that the string entered is escaping once before it is evaluated.

1 Like