Interview Prep/Terraform/Loops, Conditionals, Dynamic Blocks and Functions

What are `regex`, `regexall` and `replace` used for?

IntermediateConceptLoops, Conditionals, Dynamic Blocks and Functions
Answer

regex(pattern, str) returns the first match or errors if none, so wrap with try or can. regexall returns a list of all matches (empty if none). replace(str, search, repl) substitutes, treating a search wrapped in /.../ as regex. Terraform uses RE2 syntax.

All Terraform questions Roadmap: Terraform

More on Loops, Conditionals, Dynamic Blocks and Functions