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

Overpass turbo regular expression with [] choice

0

I'm trying to find peaks in an area where the elevation contains other characters than numbers and the decimal point. I started with the non-negated regexp to test and got quite far: [out:csv(name,ele)]; area[name="Plzeň"]; node(area)[natural=peak][ele]["ele"~"^[[:digit:]]+$"]; out; But I can't find out how to add the decimal point to the regexp. The obvious thing doesn't work: [out:csv(name,ele)]; area[name="Plzeň"]; node(area)[natural=peak][ele]["ele"~"^[[[:digit:]]\.]+$"]; out; How to do that? Does Overpass QL not support []s? Or am I just missing something? (The area specified does contain peaks with both decimal point and without.) Note: I could probably do this, although imperfect, but I'm still curious about how to do it properly.

Edit - examples of what I want to match: ele=123 ele=1.234

Examples of what I don't want to match: ele=123. ele=123m ele=123.45 m

asked 30 Dec '19, 18:35

V0174's gravatar image

V0174
16226
accept rate: 0%

edited 31 Dec '19, 08:22

2

Can you put a couple examples in your text, of what you do want to match and what you don't want to match? I don't think I fully understand what you want, but I think ["ele"~"[0-9.]+"] does the same thing as your queries.

(30 Dec '19, 23:05) maxerickson

Thanks, that helped me to find the problem - dot should not be escaped inside of square brackets in Overpass QL.

(31 Dec '19, 08:43) V0174

One Answer:

0

OK, thanks to maxerickson helping me to got to the right path, it seems it was a regex issue - dot inside of [] [doesn't need to be escaped]1. I would expect that it'd work with escaping too, but that's Overpass.


Working example

An improved example of what I wanted to do - list of peaks with potentially wrong elevation in France.

answered 31 Dec '19, 08:40

V0174's gravatar image

V0174
16226
accept rate: 0%

edited 31 Dec '19, 08:41

Source code available on GitHub .