terraform-regex-patterns

Provides Terraform regex patterns for built-in functions like regex, regexall, and replace.

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/Luscii/terraform-fluentbit-config-renderer --skill terraform-regex-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-regex-patterns
Source: https://github.com/Luscii/terraform-fluentbit-config-renderer/tree/main/.github/skills/terraform-regex-patterns
Command: npx skills add https://github.com/Luscii/terraform-fluentbit-config-renderer --skill terraform-regex-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a ready-to-use library of Terraform regex patterns and examples for the built-in regex functions (regex, regexall, and replace), reducing guesswork and errors when matching strings in Terraform configurations.

Core Features & Use Cases

  • Pattern Library: A curated set of regular expressions with RE2 syntax and inline usage examples.
  • Practical Scenarios: Validate emails, extract digits, and match common identifiers (dates, AWS ARNs) within Terraform code.
  • Use Case: Apply these patterns to quickly implement data validation and string manipulation in your Terraform modules.

Quick Start

Use the Terraform regex patterns to validate a sample email with regex("^[\w._%+-]+@[\w.-]+\.[a-zA-Z]{2,}$", var.email).

Frequently Asked Questions about terraform-regex-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use regex to validate an email address in Terraform?

You can validate emails in Terraform by applying the regex function with a pattern such as regex("^[\w._%+-]+@[\w.-]+\.[a-zA-Z]{2,}$", var.email) to match standard email formats.

What is the difference between regex and regexall in Terraform?

In Terraform, the regex function finds the first match of a pattern in a string, while regexall returns a list of all matching substrings, allowing you to extract multiple occurrences of digits or identifiers within your configurations.

Can I use standard regular expression syntax for string matching in Terraform?

Terraform uses RE2 syntax for its string matching functions, which covers common sequences and flags. This skill provides a curated library of RE2-compliant patterns to ensure compatibility and reduce syntax errors.

How do I extract digits or parse AWS ARNs using Terraform string functions?

You can extract digits or parse AWS ARNs by using the regex or regexall functions with specific RE2 patterns to capture matching groups, enabling precise identifier parsing directly within your Terraform modules.

What is the best way to replace matching text in a Terraform variable?

The best way to replace matching text in a Terraform variable is using the built-in replace function combined with RE2 pattern matching to identify and swap targeted substrings within your configuration strings.