title: regex match keywords that are not in quotes
body: <p>How will I be able to look for kewords that are not inside a string.</p>
  
  <p>For example if I have the text:</p>
  
  <blockquote>
    <p>Hello this text is an example.</p>
    
    <p>bla bla bla "this text is inside a string"</p>
    
    <p>"random string" more text bla bla bla "foo"</p>
  </blockquote>
  
  <p>I will like to be able to match all the words <code>text</code> that are not inside <code>" "</code>. In other I will like to match:</p>
  
  <p><img src="https://i.stack.imgur.com/vDAY5.png" alt="enter image description here"></p>
  
  <p>note I do not want to match the text that is highlighted on red because it is inside a string</p>
  
  <hr>
  
  <p><strong>Possible solution:</strong></p>
  
  <p>I been working on it and this is what I have so far:</p>
  
  <p><code>(?s)((?&lt;q&gt;")|text)(?(q).*?"|)</code>  </p>
  
  <p>note that regex uses the if statement as:  (?(predicate) true alternative|false alternative)</p>
  
  <p>so the regex will read:</p>
  
  <blockquote>
    <p>find " or text. If you find " then continue selecting until you find " again (.*?") if you find text then do nothing...</p>
  </blockquote>
  
  <p>when I run that regex I match the whole string though. I am asking this question for purposes of learning. I know I can remove all strings then look for what I need.</p>