title: Regex with optional word inside string
body: <p>I try to Regex the following line (each word separated by one space):</p>
  
  <pre><code>Firstpartstring thisisoptional secondpartstring
  </code></pre>
  
  <p>I expect each string to match as group:</p>
  
  <pre><code>Group 1.    Firstpartstring
  Group 2.    thisisoptional
  Group 3.    secondpartstring
  </code></pre>
  
  <p>This is what I tried so far:</p>
  
  <pre><code>(.*?)\s(thisisoptional)?\s(.*)
  </code></pre>
  
  <p>Only problem is, if "thisisoptional" does not exist inside the string, I don't get any results.</p>
  
  <p>I expect:</p>
  
  <pre><code>Group 1.    Firstpartstring
  Group 2.    
  Group 3.    secondpartstring
  </code></pre>
  
  <p>Please check this demo: <a href="https://regex101.com/r/YBlYXm/1" rel="nofollow noreferrer">https://regex101.com/r/YBlYXm/1</a></p>
  
  <p>Can anyone get me in the right direction?</p>
  
  <p>Thanks</p>