title: How to check if a string matches a pattern in vim
body: <p>I am trying to write a fold expression, but I can't get the regex to work. </p>
  
  <p>The string I want to check for and the regex are:</p>
  
  <pre><code># -- Heading 1 --
  </code></pre>
  
  <pre><code>^.*-{2}\s([\_a-zA-Z0-9]\s*)+\s-{2}$
  </code></pre>
  
  <p>what syntax do I use to do the check?
  I tried: (non seemed to work)</p>
  
  <p><code>if match(line , "\v regex") &gt;= 0
   if line =~ "\v regex"</code></p>