title: Lazy Regex Match in .NET. What's wrong here?
body: <p>In the following example I would like to retrieve the text <i>between</i> pMAINp and the <i>first</i> pMDSp. The regex has a look-behind and a look-ahead:</p>
  
  <pre><code>string contents = "pMAINp MAP B FlightTest Load pMDSp ZutiCarrier pWingp some pMDSp more pWingp end";
  string blockMainRegex = @"(?&lt;=pMAINp)[\s\w+]+(?=(pMDS)?)";
  </code></pre>
  
  <p>The result I was hoping for was:
  " MAP B FlightTest Load "</p>
  
  <p>but what it returns is:
  "MAP B FlightTest Load pMDSp ZutiCarrier pWingp some pMDSp more pWingp end"</p>
  
  <p>You'll notice that I'm attempting a lazy match here: (pMDS)? which clearly isn't working! 
  Any help with this would be much appreciated. Thanks. :-)</p>
  
  <p><b>EDIT</b>: Whoops, the sought text has been corrected.</p>
  
  <p>This works great:<br>
      string blockMainRegex = @"(?&lt;=pMAINp)[\s\w+]+?(?=pMDS)";</p>