title: Accept all characters if string present but only up to occurence of character
body: <p>I'm trying to come up with a regular expression that matches strings that contain a certain string but only up to the first occurrence of a character.</p>
  
  <p>In this case, I want it to match a string that contains <strong>foo.com</strong> but ignores everything up to and including the first occurrence of a question mark.</p>
  
  <p>e.g. <strong><a href="https://www.foo.com/some/folder/page.cgi" rel="nofollow noreferrer">https://www.foo.com/some/folder/page.cgi</a></strong>?ignore=params</p>
  
  <p>I know that I can get all the characters before <code>?</code> with the following regex:</p>
  
  <pre><code>(^.*)(?=\?)
  </code></pre>
  
  <p>And that I can limit the strings found to those containing <strong>foo.com</strong> with the following:</p>
  
  <pre><code>^.*(foo.com){1}.*$
  </code></pre>
  
  <p>But can I do this in one expression?</p>