title: Regex Matching everything between 2 repeating values
body: <p>I am making a reminder application and I want to be able to support iCalender importing. This is why I want to be able to extract events. This is the basic format of an event in iCalender:</p>
  
  <pre><code>BEGIN:VEVENT
  ......
  ......
  END:VEVENT
  </code></pre>
  
  <p>All of these events are in one file so I will have a big list like this:</p>
  
  <pre><code>BEGIN:VEVENT
  ......
  ......
  END:VEVENT
  BEGIN:VEVENT
  ......
  ......
  END:VEVENT
  </code></pre>
  
  <p>These events will have a start date and an end date</p>
  
  <pre><code>BEGIN:VEVENT
  ......
  DTSTART;VALUE=DATE:20160402
  DTEND;VALUE=DATE:20160403
  ......
  END:VEVENT
  </code></pre>
  
  <p>When trying to extract just the event, it is not always the same format. The start date and end date can be before or after other certain fields. </p>
  
  <p>Currently I have:</p>
  
  <pre><code>/BEGIN:VEVENT[\s\S]*?DTSTART;VALUE=DATE:20160402[\s\S]*?END:VEVENT/
  </code></pre>
  
  <p>However this doesn't match just the event itself, it matches from the first match of <code>BEGIN:VEVENT</code>, matches everything until the date, and then finishes the match at the following <code>END:VEVENT</code>.</p>
  
  <p>So in some of the events further down the list trying to match them includes lots of others. Is there a way I can match the <code>DTSTART;VALUE=DATE:</code> and only the previous nearest <code>BEGIN:VEVENT</code> and the following <code>END:VEVENT</code> just to extract the single event for that day?</p>