'Terraform Validation Failing Over Correct Regex

Why cant terraform validate this regex with the example: testingname01? If I evaluate this expression here: https://regex101.com/r/ALETmb/1. It works and matches, but terraform validate returns me an │ Error: Invalid value for variable.

variable "name" {
  type        = string
  description = "The name."
  validation {
    condition     = can(regex("^(?!.*--)[a-zA-Z].{1,22}[a-z0-9A-Z]$", var.name))
    error_message = "Name must be between 3-24 alphanumeric characters, the name must begin with a letter, end with a letter or digit, and not contain consecutive hyphens."
  }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source