hashicorp / terraform-plugin-framework-validators

Common Use Case Validators for terraform-plugin-framework
Mozilla Public License 2.0
25 stars 12 forks source link

regex validator support for negative MatchString #205

Open neatcoder opened 7 months ago

neatcoder commented 7 months ago

Terraform CLI and Framework Versions

TF: 1.7.5 framework: 0.12.0

Use Cases or Problem Statement

Since golang doesn't support lookahead and lookbehind regular expressions, it would be easier to have a solution in stringvalidator package for negative regex match. For example: Validation to match any string that does not start with GITHUB_. Usually it is done with negative lookahead but golang does not support it. TF Framework only supports "match" pattern but there is no function provided o work with elimination or strings that don't match a pattern.

Proposal

New RegexNotMacthes function could be defined in stringvalidator package so that it approves a string that does not match a given regex pattern.

Additional Information

No response

Code of Conduct