regexopenstreetmapoverpass-api

Invert a regular expression match in Overpass API


I want to search for possibly wrong ICAO codes using Overpass API. While matching an ICAO code is fairly trivial with the RegEx ^[A-Z]{4}$, I'm trying to match everything that does not match this RegEx. How can I negate the RegEx?

I want to use this RegEx in the tool Overpass-Turbo.


Solution

  • According to the docs, you can use the !~ operator to match the invert of ^[A-Z]{4}$:

    nwr["icao"!~"^[A-Z]{4}$"]