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.
More on Loops, Conditionals, Dynamic Blocks and Functions
How does `count` work?BeginnerHow does `for_each` work?BeginnerWhen should you choose `for_each` over `count`?IntermediateHow do you use `for_each` with a list of objects?IntermediateWhat does "The for_each value depends on resource attributes that cannot be determined until apply" mean?AdvancedHow do you create a resource conditionally?Beginner