title: Regex: Get anything before
body: <p>I'm coding my own .INI file reader and making it as expansive and fixed as possible to work in many situations.</p>
  
  <p>The wiki says some programs use the ';' semicolon for comments, and some use '#' hash.</p>
  
  <p>I'm trying to utilize Regex to remove comments on any lines' value, here's what I've come up with;</p>
  
  <p>This is the INI text file:</p>
  
  <pre><code>t1 = t2
  t3 = t4 ;test
  t5 = t6 #test
  </code></pre>
  
  <p>The code in practice:</p>
  
  <pre><code>value = Regex.Match(value, ".*(?=;|#");
  </code></pre>
  
  <p>Which does work! But only get the second and third line.</p>
  
  <p>The positive lookahead '(?=;|#")', how would I make it optional? (like, only if it contains the ';' or '#' then substring it), hopefully my goal here is clear, if not let me know.</p>