title: Use regex in helm template
body: <p>I'm trying to provide a condition inside my helm template to check for a valid (or a rather invalid) hostname using <code>regexMatch</code> function.</p>
  <p>Here's my line of code that I'm using:</p>
  <pre class="lang-yaml prettyprint-override"><code>{{- if regexMatch &quot;(?:[0-9]{1,3}\.){3}[0-9]{1,3}$&quot; .Values.hostname }}
  </code></pre>
  <p>The related part in the values file is a simple one:</p>
  <pre class="lang-yaml prettyprint-override"><code>hostname: 10.10.10.10
  </code></pre>
  <p>However, I'm hitting a syntax error with no real explanation:<br />
  <code>Error: parse error at (api-gateway/templates/ingress.yml:1): invalid syntax</code></p>
  <p>When I've tried to use the example from the docs: <a href="https://helm.sh/docs/chart_template_guide/function_list/#regexmatch-mustregexmatch" rel="nofollow noreferrer">https://helm.sh/docs/chart_template_guide/function_list/#regexmatch-mustregexmatch</a>
  it obviously worked, so I wonder why my code isn't working.</p>