Filter a map when string not matched?

Hi. I’m just getting started with Terraform and I’m stuck on what seems like a simple and common thing.
I have an input variable that’s a list I’m pulling in from a json file with jsdondecode().
I would like to execute a resource for everything in the list and then execute another resource for a subset of the list where the name doesn’t match a string.
I’ve found the regexall() function and have it working with a positive match, but I can’t get it working with a negative match.

host_data = jsondecode(file("${path.module}/test_hosts.json"))
looks like this:
[
    {
        "name":  "hostname01.derp.net",
        "ccode":  "aaaa"
    },
    {
        "name":  "hostname01-idrac.derp.net",
        "ccode":  "aaaa"
    },
...truncated...
]

This statement works to create a map from “host_data” that positively matches the string “idrac”.

new_host_map = {for val in local.host_data : val["name"] => val if length(regexall("idrac", val["name"])) > 0}

What I need is to NOT match the string “idrac”. How can I do this?
I have tried several permutations with no luck like:

new_host_map = {for val in local.host_data : val["name"] => val if length(regexall("(?U:idrac)", val["name"])) > 0}
new_host_map = {for val in local.host_data : val["name"] => val if length(regexall("(?!idrac)", val["name"])) > 0}

Thanks for any suggestions,
Jeremy

Um, why are you so intent on doing the negation inside the regex? Just use the logical NOT operator (!) in the Terraform expression.

Geez…I’m an idiot. Thank you.

new_host_map = {for val in local.host_data : val["name"] => val if !(length(regexall("idrac", val["name"])) > 0})