title: Regular expressions in Terraform
body: <p>I need to use regular expressions in my Terraform code. The <a href="https://www.terraform.io/docs/configuration/interpolation.html#replace_string_search_replace_" rel="noreferrer">documentation for the replace function</a> says the string if wrapped in a forward slash can be treated as a regex.</p>
  
  <p>I've tried the following:</p>
  
  <pre><code>Name = "${replace(var.string, var.search | lower(var.search), replace)}"
  </code></pre>
  
  <p>I need to use regex to replace either the string or the lower case of the string with the replace string.</p>