title: CMake regex match
body: <p>I have a CMake string variable:</p>
  
  <pre><code>set(var "String0 String_1 String_2")
  </code></pre>
  
  <p>I need to select whatever is before the first whitespace from this variable (<code>"String0"</code>) and make a new variable with this content.</p>
  
  <p>I used CMake's <code>REGEX MATCH</code> method to do this and used this regex: <code>'\S\w*'</code>. I have tested that regex on an online regex interpreter and it worked.</p>
  
  <p>I have written this code in CMake (after setting the variable of course):</p>
  
  <pre><code>string(REGEX MATCH "\S\w*" NEW_VAR "${VAR}")
  </code></pre>
  
  <p>When I do this the script complains about invalid skipping of characters (<code>S</code> and <code>w</code>). So, next, I tried escaping both the slashes:</p>
  
  <pre><code>string(REGEX MATCH "\\S\\w*" NEW_VAR "${VAR}")
  </code></pre>
  
  <p>Now <code>NEW_VAR</code> equal <code>'S'</code> instead of <code>"String0"</code> as I was expecting. </p>
  
  <p>Please help me correct this, since I have very little experience with regular expressions and CMake.</p>