title: How to get first match of string by Regular Expression?
body: <p>I have the following text string:</p>
  
  <p><em>$ABCD(file="somefile.txt")$' />Some more text followed by a dollar like this one)$. Some more random text</em></p>
  
  <p>I am trying to match the <em>$ABCD(file="somefile.txt")$</em> part of the string using a regular expression.</p>
  
  <p>I am using this <strong>(?=[$]ABCD[(]file=).*(?&lt;=[)][$])</strong> regular expression pattern to make the intended match. It's not working as expected because I am getting a match all the way to the second <em>)$</em> in the string. </p>
  
  <p>For example, the match will be as follows:</p>
  
  <p><em>$ABCD(file="somefile.txt")$' />Some more text followed by a dollar like this one)$</em></p>
  
  <p>How should I modify the pattern to match to the end of the first occurrence of the <em>)$</em>?</p>
  
  <p>Here is a good online regular expression engine tester:
  <a href="http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx" rel="nofollow">http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx</a></p>