Csv output de:regionalschlüssel and NUTS 3 classification

I have a question and I can’t find an answer for hours now…

I changed this code to select all regions with NUTS 3 classifications. But in the output CSV it displays the regional keys. Since the filter is for NUTS3 keys starting with “DE” there should be a way to export these keys as well right?

An example:
NUTS 3 key Stuttgart: DE111
regional key Stuttgart: 08111 or 081110000000

for other regions it is 09 in the beginning, so 08 doesn’t equal DE and also the last 3 digits differ for some regions.

The ones exported right now are the regional keys and don’t start with “DE”

[out:csv( "de:regionalschluessel", name, total, nodes, ways, relations )][date:"2020-12-31T23:59:59Z"][timeout:20];

//All NUTS 3 regions in Germany

// Count the fuel stations in each area
  // Collect all Nodes, Ways and Relations wth amenity=fuel in the current area
  ( node(area.regio)[amenity=fuel];
  make count "de:regionalschluessel" = regio.set(t[ "de:regionalschluessel"]),
             name = regio.set(t["name"]),
             total = count(nodes) + count(ways) + count(relations),
             nodes = count(nodes),
             ways = count(ways),
             relations = count(relations);

The term “ref:NUTS:3”~“^DE” has a “regular expression” right of the tilde “~”.

Are you familiar with “regular expressions”?

So “de:regionalschluessel”~“^0[1-9]” would find all regionalschluessel starting with a zero followed by the digit 1 or 2 or 3 or … 9

That’s not really what I was looking for.

I don’t want regionalschlüssel at all. So filtering by how they start won’t help me.
I want to export NUTS 3 classifications, which start with “DE”. That’s also my filter and it’s working fine, but I want to export those IDs that start with DE and not the regionalschlüssel ID which is exported right now.
Do you understand what I’m trying to describe?


So you want to replace all "de:regionalschluessel" by "ref:NUTS:3" in the query?

Yes I think I do! I want ref:NUTS:3 to be outputted in the csv instead of “de:regionalschluessel” . Maybe I don’t understand, but right now it seems like it translates the nuts classification to the regionalschlüssel and then exports this one. (See example in my first post)