With Overpass, how to exclude element with tag prefix?


With Overpass, I want to get all elements that don’t have any tag with the “contact” prefix:
Elements with neither contact= nor contact:phone= nor contact:email= etc.

How to code that element tags should not match “contact.*”?


Hello! Someone else may have a more efficient answer, but here’s what I could come up with.

I just query non-road/rail nodes and ways for examples sake, that could be anything. Then those coordinates are just a place I found with one building with a contact tag.

In this example, first everything goes into the result set “all”. Then I query “all” for anything that has a tag key that matches the regex “begins with: contact” (and has any value). The output of that gets stored in “exclude”. And then the final result is “all” minus “exlcude”.


(.all; - .exclude;);

out geom;