title: preg_match_all works on snippets but not entire web page
body: <p>I have a regex that works with small portions of code but when running it on the entire page it only returns the first match. Why? </p>
  
  <p>My question is related to <a href="https://stackoverflow.com/questions/13016458/preg-match-backreference-to-find-ending-tag">preg_match backreference to find ending tag</a>. But now I have a different issue.</p>
  
  <p><strong>Regex that comes from the below code</strong></p>
  
  <pre><code>/\{(.*?)_start\}.*\{\1_stop\}/s
  </code></pre>
  
  <p><strong>Preg_match_all</strong></p>
  
  <pre><code>$loopPattern = "/\\$this-&gt;tokenStartDelimiter(.*?)_start\\$this-&gt;tokenStopDelimiter.*\\$this-&gt;tokenStartDelimiter\\1_stop\\$this-&gt;tokenStopDelimiter/s";
  preg_match_all($loopPattern, $this-&gt;template, $matches);
  foreach ($matches[0] as $match) {
      $this-&gt;template = str_replace($match, '', $this-&gt;template);
  }
  </code></pre>
  
  <p><strong>Whole Page</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0"&gt;
      &lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;
      &lt;link rel="apple-touch-icon" href="apple-touch-icon.png"&gt;
  
      &lt;title&gt;Appointment-Plus&lt;/title&gt;
  
      &lt;!--&lt;link rel="stylesheet" href="css/themes/default/jquery.mobile.theme-1.2.0.min.css"&gt; --&gt;
      &lt;link rel="stylesheet" href="css/themes/apcv/APCV-Theme.min.css"&gt;
      &lt;link rel="stylesheet" href="css/themes/default/jquery.mobile.structure-1.2.0.min.css"&gt;
  
      &lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.mobile-1.2.0.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/jquery.validate.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/pages/all.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="css/mfe.css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div data-role="page" data-theme="d"&gt;
      &lt;!-- Some icons by Yusuke Kamiyamane. --&gt;
      &lt;div data-id="head" data-role="header" data-position="fixed" data-theme="b" data-tap-toggle="false"&gt;
          &lt;h1&gt;DB Games&lt;/h1&gt;
          &lt;a href="#" id="headingsActionButton" class="ui-btn-right headingsActionButton hidden" data-role="button" data-inline="true" data-icon="check"&gt;Save&lt;/a&gt;
  
      &lt;/div&gt;
  
      &lt;div id="mainContent" data-role="content"&gt;
      &lt;!--    &lt;div data-role="fieldcontain"&gt;
              &lt;div style="width: 100%; height: 100px; position: relative; background-color: #fbfbfb; border: 1px solid #b8b8b8;"&gt;
                  &lt;img src="https://codiqa.com/static/images/v2/image.png" alt="image" style="position: absolute; top: 50%; left: 50%; margin-left: -16px; margin-top: -18px;"&gt;
              &lt;/div&gt;
          &lt;/div&gt; --&gt;
          &lt;div data-role="fieldcontain"&gt;
      &lt;div data-role="collapsible-set" class="mfe_collapsibles" data-theme="c" data-inset="false"&gt;
  
          &lt;div id="appointmentHeading" data-action-id="appointmentNext" data-action-text="Next" data-a data-role="collapsible" data-collapsed="true" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d" data-iconpos="right"&gt;
              &lt;h3 class="collapsibleMainHeading"&gt;New Appointment&lt;/h3&gt;
              &lt;p&gt;
                  &lt;script src="js/pages/newAppointment.js"&gt;&lt;/script&gt;
  &lt;div data-role="collapsible-set" data-content-theme="c" class="appointmentMakeCollapsibleSet"&gt;
      &lt;div data-role="collapsible" data-collapsed="false" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d"&gt;
          &lt;h3&gt;Appointment&lt;/h3&gt;
          &lt;p&gt;
              &lt;form id="appointmentPrimaryForm"&gt;
  
      &lt;label for="c_id" class="select required" required&gt;Location: &lt;/label&gt;
      &lt;select name="c_id" id="c_id" data-native-menu="true" class="select required" required&gt;
          &lt;option value="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
  
          &lt;option value="261"
          selected&gt;Mesa&lt;/option&gt;
          &lt;option value="1007"
          &gt;Chandler&lt;/option&gt;
      &lt;/select&gt;
  
  
  
      {AppointmentStaffSelect_start}
      &lt;label for="apptCreateEditStaff" class="select required" required&gt;With: &lt;/label&gt;
      &lt;select name="apptCreateEditStaff" id="apptCreateEditStaff" data-native-menu="true" class="select required" required&gt;
          &lt;option value="" data-service="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
  
          &lt;option data-service="{Services}" value="5490"
          &gt;Brian&lt;/option&gt;
          &lt;option data-service="{Services}" value="4388"
          &gt;Mckenna&lt;/option&gt;
          &lt;option data-service="{Services}" value="4387"
          &gt;Katelyn&lt;/option&gt;
          &lt;option data-service="{Services}" value="783"
          &gt;David&lt;/option&gt;
          &lt;option data-service="{Services}" value="4389"
          &gt;Ryan&lt;/option&gt;
          &lt;option data-service="{Services}" value="4394"
          &gt;Ryan - c&lt;/option&gt;
          &lt;option data-service="{Services}" value="784"
          &gt;Tami&lt;/option&gt;
          &lt;option data-service="{Services}" value="4390"
          &gt;Jake&lt;/option&gt;
      &lt;/select&gt;
      {AppointmentStaffSelect_stop}
      &lt;p&gt;{Test}&lt;/p&gt;
  {AppointmentTest_start}
  &lt;p&gt;&lt;/p&gt;
  {AppointmentTest_stop}
  
      &lt;label for="service_id" class="select required"&gt;Service: &lt;/label&gt;
      &lt;select name="service_id" id="service_id" data-native-menu="true" class="select required" required&gt;
          &lt;option value="" data-placeholder="true" data-duration="0" data-cost="0.00"&gt;Choose One&lt;/option&gt;
          &lt;option value="1174|30 Minute Gaming Pass" class="{Classes}" data-cost="3.00" data-duration="30"&gt;30 Minute Gaming Pass&lt;/option&gt;
          &lt;option value="1176|1 Hour Gaming Pass" class="{Classes}" data-cost="5.00" data-duration="60"&gt;1 Hour Gaming Pass&lt;/option&gt;
          &lt;option value="1177|2 Hour Gaming Pass" class="{Classes}" data-cost="7.00" data-duration="120"&gt;2 Hour Gaming Pass&lt;/option&gt;
      &lt;/select&gt;
  
      {AppointmentAddonService_start}
      &lt;fieldset data-role="controlgroup" id="apptCreateEditAddonServicesFieldset"&gt;
          &lt;legend&gt;Add-on Service(s):&lt;/legend&gt;
  
          &lt;input type="checkbox" name="aos-5059" id="aos-5059" data-duration="30" data-cost="10.00" class="custom {Classes}"   /&gt;
          &lt;label for="aos-5059" class="{Classes}"&gt;Unlimited Snack Bar&lt;/label&gt;
  
          &lt;input type="checkbox" name="aos-5060" id="aos-5060" data-duration="30" data-cost="5.00" class="custom {Classes}"   /&gt;
          &lt;label for="aos-5060" class="{Classes}"&gt;Unlimited Energy Drinks&lt;/label&gt;
  
          &lt;input type="checkbox" name="aos-5061" id="aos-5061" data-duration="30" data-cost="1.00" class="custom {Classes}"   /&gt;
          &lt;label for="aos-5061" class="{Classes}"&gt;Candy Bar&lt;/label&gt;
  
      &lt;/fieldset&gt;
      {AppointmentAddonService_stop}
  
      &lt;label for="apptCreateEditDate" class="select required" required&gt;Date: &lt;/label&gt;
      &lt;select name="apptCreateEditDate" id="apptCreateEditDate" data-native-menu="true" class="select required" required&gt;
          &lt;option value="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
          {apptCreateEditDateOption_start}
          &lt;option value="{Value}"
          {Selected}&gt;{Name}&lt;/option&gt;{apptCreateEditDateOption_stop}
      &lt;/select&gt;
  
      &lt;label for="apptCreateEditTime" class="select required" required&gt;Time: &lt;/label&gt;
      &lt;select name="apptCreateEditTime" id="apptCreateEditTime" data-native-menu="true" class="select required" required&gt;
          &lt;option value="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
          {apptCreateEditTimeOption_start}
          &lt;option value="{Value}"
          {Selected}&gt;{Name}&lt;/option&gt;{apptCreateEditTimeOption_stop}
      &lt;/select&gt;
  &lt;/form&gt;
          &lt;/p&gt;
      &lt;/div&gt;
      &lt;div data-role="collapsible" data-collapsed="true" class="ui-disabled" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d"&gt;
          &lt;h3&gt;Children&lt;/h3&gt;
          &lt;p&gt;
              Page 2
          &lt;/p&gt;
      &lt;/div&gt;
      &lt;div data-role="collapsible" data-collapsed="true" class="ui-disabled" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d"&gt;
          &lt;h3&gt;Appointment Details&lt;/h3&gt;
          &lt;p&gt;
  
  
  
  &lt;label for="customer_notes"&gt;Special Instructions for Customer: &lt;/label&gt;
  &lt;textarea cols="40" rows="8" name="customer_notes" id="customer_notes"&gt;&lt;/textarea&gt;
  
  
  {apptCreateEditPONumber_start}
  &lt;label for="apptCreateEditPONumber" class="{Class}"&gt;{LName}: &lt;/label&gt;
  &lt;input type="text" id="apptCreateEditPONumber" name="apptCreateEditPONumber" class="{Class}" value=""/&gt;
  {apptCreateEditPONumber_stop}
  
  {apptCreateEditVehicleMake_start}
  &lt;label for="apptCreateEditMakeId" class="select {Class}"&gt;{LName}: &lt;/label&gt;
  &lt;select name="apptCreateEditMakeId" id="apptCreateEditMakeId" data-native-menu="true" class="select {Class}"&gt;
      &lt;option value="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
      {apptCreateEditMakeOption_start}
      &lt;option value="{Value}"
      {Selected}&gt;{Name}&lt;/option&gt;{apptCreateEditMakeOption_stop}
  &lt;/select&gt;
  {apptCreateEditVehicleMake_stop}
  
  {apptCreateEditVehicleModel_start}
  &lt;label for="apptCreateEditModelId" class="select {Class}"&gt;{LName}: &lt;/label&gt;
  &lt;select name="apptCreateEditModelId" id="apptCreateEditModelId" data-native-menu="true" class="select {Class}"&gt;
      &lt;option value="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
      {apptCreateEditModelOption_start}
      &lt;option value="{Value}" class="{Make}"
      {Selected}&gt;{Name}&lt;/option&gt;{apptCreateEditModelOption_stop}
  &lt;/select&gt;
  {apptCreateEditVehicleModel_stop}
  
  {apptCreateEditVehicleYear_start}
  &lt;label for="apptCreateEditModelYear" class="{Class}"&gt;{LName}: &lt;/label&gt;
  &lt;select name="apptCreateEditModelYear" id="apptCreateEditModelYear" data-native-menu="true" class="select {Class}"&gt;
      &lt;option value="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
      {apptCreateEditYearOption_start}
      &lt;option value="{Value}"
      {Selected}&gt;{Name}&lt;/option&gt;{apptCreateEditYearOption_stop}
  &lt;/select&gt;
  {apptCreateEditVehicleYear_stop}
  
  {apptCreateEditVehicleOther_start}
  &lt;label for="apptCreateEditOtherVehicle" class="{Class}"&gt;{LName}: &lt;/label&gt;
  &lt;input type="text" id="apptCreateEditOtherVehicle" name="apptCreateEditOtherVehicle" class="{Class}" value="{ApptCreateEditVehicleOther}"/&gt;
  {apptCreateEditVehicleOther_stop}
  
  {apptCreateEditVehicleVIN_start}
  &lt;label for="apptCreateEditVIN" class="{Class}"&gt;{LName}: &lt;/label&gt;
  &lt;input type="text" id="apptCreateEditVIN" name="apptCreateEditVIN" class="{Class}" value="{ApptCreateEditVehicleVIN}"/&gt;
  {apptCreateEditVehicleVIN_stop}
  
  {apptCreateEditVehicleOdometer_start}
  &lt;label for="apptCreateEditOdometer" class="{Class}"&gt;{LName}: &lt;/label&gt;
  &lt;input type="number" id="apptCreateEditOdometer" name="apptCreateEditOdometer" class="{Class}" value="{ApptCreateEditVehicleOdometer}"/&gt;
  {apptCreateEditVehicleOdometer_stop}
          &lt;/p&gt;
      &lt;/div&gt;
  
      &lt;div data-role="collapsible" class="postRegistrationCollapsible ui-disabled" data-collapsed="true" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d"&gt;
          &lt;h3&gt;Register / Login&lt;/h3&gt;
          &lt;p&gt;
              &lt;script src="js/pages/postRegistration.js"&gt;&lt;/script&gt;
  &lt;div data-role="fieldcontain" class="hidden"&gt;
      &lt;p id="postRegistrationMessage"&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;a href="#registerPopupDiv" class="postRegistrationButtons" data-role="button" data-rel="popup" data-inline="true"&gt;Register&lt;/a&gt;
  &lt;a href="#loginPopupDiv" class="postRegistrationButtons" data-role="button" data-rel="popup" data-inline="true"&gt;Login&lt;/a&gt;
  &lt;div id="registerPopupDiv" data-role="popup" data-overlay-theme="a" class="ui-content" data-corners="true" data-shadow="true" data-position-to="window" data-transition="flow" data-theme="c"&gt;
      &lt;form id="registerFormPopup" data-ajax="false"&gt;
      &lt;div data-role="fieldcontain" data-inset="false"&gt;
  
  &lt;label for="first_name" class="required"&gt;First Name1:&lt;/label&gt;
  &lt;input type="text" id="first_name" name="first_name" value="{Value}" class="required" required/&gt;
  
  &lt;label for="middle_name" class="{Class}"&gt;Middle Name:&lt;/label&gt;
  &lt;input type="text" id="middle_name" name="middle_name" value="{Value}" class="{Class}" {Required}/&gt;
  
  &lt;label for="last_name" class="required"&gt;Last Name1:&lt;/label&gt;
  &lt;input type="text" id="last_name" name="last_name" value="{Value}" class="required" required/&gt;
  
  &lt;label for="email" class="{Class}"&gt;eMail:&lt;/label&gt;
  &lt;input type="email" id="email" name="email" value="{Value}" class="{Class}" {Required}/&gt;
  
  &lt;label for="login" class="{Class}"&gt;Login:&lt;/label&gt;
  &lt;input type="text" id="login" name="login" value="{Value}" class="{Class}" {Required}/&gt;
  
  &lt;label for="password" class="{Class}"&gt;Password:&lt;/label&gt;
  &lt;input type="password" id="password" name="password" value="{Value}" class="{Class}" {Required}/&gt;
  
  &lt;label for="customer_id_unique"&gt;Customer ID:&lt;/label&gt;
  &lt;input type="text" id="customer_id_unique" name="customer_id_unique" value="{Value}" class="readonly" readonly/&gt;
  
      &lt;/div&gt;
      &lt;div data-role="fieldcontain" data-inset="false"&gt;
          &lt;input type="button" name="registerPopupButton" id="registerPopupButton" value="Register"/&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;div id="loginPopupDiv" data-overlay-theme="a" data-role="popup" class="ui-content" data-corners="true" data-shadow="true" data-position-to="window" data-transition="flow" data-theme="c"&gt;
      &lt;form id="loginFormPopup" data-ajax="false"&gt;
      &lt;div data-role="fieldcontain" class="ui-hide-label"&gt;
          &lt;label for="login-username"&gt;Username:&lt;/label&gt;
          &lt;input type="text" name="login-username" id="login-username" value="" placeholder="Username"/&gt;
  
      &lt;/div&gt;
      &lt;div data-role="fieldcontain" class="ui-hide-label"&gt;
  
          &lt;label for="login-password"&gt;Password&lt;/label&gt;
          &lt;input type="password" name="login-password" id="login-password" value="" placeholder="Password"/&gt;
      &lt;/div&gt;
      &lt;div data-role="fieldcontain" data-inset="false"&gt;
          &lt;input type="button" name="loginPopupButton" id="loginPopupButton" value="Login"/&gt;
      &lt;/div&gt;
      &lt;div data-role="fieldcontain" data-inset="false"&gt;
          &lt;a href="#" id="forgotPopupPassword" data-rel="popup"&gt;Forgot Password?&lt;/a&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
          &lt;/p&gt;
      &lt;/div&gt;
  
      &lt;div data-role="collapsible" data-collapsed="true" class="ui-disabled" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d"&gt;
          &lt;h3&gt;Verification&lt;/h3&gt;
          &lt;p&gt;
              Page 5
          &lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
              &lt;/p&gt;
          &lt;/div&gt;
  
          {RegisterSection_start}
          &lt;div id="registerHeading" class="preRegistration" data-action-id="register" data-action-text="Register" data-role="collapsible" data-collapsed="true" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d" data-iconpos="right"&gt;
              &lt;h3 class="collapsibleMainHeading"&gt;Register&lt;/h3&gt;
              &lt;p&gt;
                  &lt;script src="js/pages/register.js"&gt;&lt;/script&gt;
  &lt;form id="registerForm" data-ajax="false"&gt;
      &lt;div data-role="fieldcontain" data-inset="false"&gt;
  
  &lt;label for="first_name" class="required"&gt;First Name1:&lt;/label&gt;
  &lt;input type="text" id="first_name" name="first_name" value="{Value}" class="required" required/&gt;
  
  &lt;label for="middle_name" class="{Class}"&gt;Middle Name:&lt;/label&gt;
  &lt;input type="text" id="middle_name" name="middle_name" value="{Value}" class="{Class}" {Required}/&gt;
  
  &lt;label for="last_name" class="required"&gt;Last Name1:&lt;/label&gt;
  &lt;input type="text" id="last_name" name="last_name" value="{Value}" class="required" required/&gt;
  
  &lt;label for="email" class="{Class}"&gt;eMail:&lt;/label&gt;
  &lt;input type="email" id="email" name="email" value="{Value}" class="{Class}" {Required}/&gt;
  
  &lt;label for="login" class="{Class}"&gt;Login:&lt;/label&gt;
  &lt;input type="text" id="login" name="login" value="{Value}" class="{Class}" {Required}/&gt;
  
  &lt;label for="password" class="{Class}"&gt;Password:&lt;/label&gt;
  &lt;input type="password" id="password" name="password" value="{Value}" class="{Class}" {Required}/&gt;
  
  &lt;label for="customer_id_unique"&gt;Customer ID:&lt;/label&gt;
  &lt;input type="text" id="customer_id_unique" name="customer_id_unique" value="{Value}" class="readonly" readonly/&gt;
  
      &lt;/div&gt;
      &lt;div data-role="fieldcontain" data-inset="false"&gt;
          &lt;input type="button" name="register" id="register" value="Register"/&gt;
      &lt;/div&gt;
  &lt;/form&gt;
              &lt;/p&gt;
          &lt;/div&gt;
          {RegisterSection_stop}
          &lt;div data-role="collapsible" class="preRegistration" data-collapsed="true" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d" data-iconpos="right"&gt;
              &lt;h3 class="collapsibleMainHeading"&gt;Login&lt;/h3&gt;
              &lt;p&gt;
                  &lt;script src="js/pages/login.js"&gt;&lt;/script&gt;
  &lt;form id="loginForm" data-ajax="false"&gt;
      &lt;div data-role="fieldcontain" class="ui-hide-label"&gt;
          &lt;label for="login-username"&gt;Username:&lt;/label&gt;
          &lt;input type="text" name="login-username" id="login-username" value="" placeholder="Username"/&gt;
  
      &lt;/div&gt;
      &lt;div data-role="fieldcontain" class="ui-hide-label"&gt;
  
          &lt;label for="login-password"&gt;Password&lt;/label&gt;
          &lt;input type="password" name="login-password" id="login-password" value="" placeholder="Password"/&gt;
      &lt;/div&gt;
      &lt;div data-role="fieldcontain" data-inset="false"&gt;
          &lt;input type="submit" name="loginSubmit" id="loginSubmit" value="Login"/&gt;
      &lt;/div&gt;
      &lt;div data-role="fieldcontain" data-inset="false"&gt;
          &lt;a href="#passwordResetDiv" data-rel="popup"&gt;Forgot Password?&lt;/a&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;script src="js/pages/passwordReset.js"&gt;&lt;/script&gt;
  
  &lt;div id="passwordResetDiv" data-overlay-theme="a" data-role="popup" class="ui-content" data-corners="true" data-shadow="true" data-position-to="window" data-transition="flow" data-theme="c"&gt;
      &lt;form id="passwordResetForm"&gt;
          &lt;div data-role="fieldcontain" class="ui-hide-label"&gt;
              &lt;label for="email"&gt;Email:&lt;/label&gt;
              &lt;input type="text" name="email" id="email" value="" placeholder="Email" class="required" required/&gt;
          &lt;/div&gt;
          &lt;div data-role="fieldcontain" data-inset="false"&gt;
              &lt;input type="submit" name="submit" id="submit" value="Reset Password"/&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  
              &lt;/p&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Result from entire page</strong></p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [0] =&gt; {AppointmentStaffSelect_start}
      &lt;label for="apptCreateEditStaff" class="select required" required&gt;With: &lt;/label&gt;
      &lt;select name="apptCreateEditStaff" id="apptCreateEditStaff" data-native-menu="true" class="select required" required&gt;
          &lt;option value="" data-service="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
  
          &lt;option data-service="{Services}" value="5490"
          &gt;Brian&lt;/option&gt;
          &lt;option data-service="{Services}" value="4388"
          &gt;Mckenna&lt;/option&gt;
          &lt;option data-service="{Services}" value="4387"
          &gt;Katelyn&lt;/option&gt;
          &lt;option data-service="{Services}" value="783"
          &gt;David&lt;/option&gt;
          &lt;option data-service="{Services}" value="4389"
          &gt;Ryan&lt;/option&gt;
          &lt;option data-service="{Services}" value="4394"
          &gt;Ryan - c&lt;/option&gt;
          &lt;option data-service="{Services}" value="784"
          &gt;Tami&lt;/option&gt;
          &lt;option data-service="{Services}" value="4390"
          &gt;Jake&lt;/option&gt;
      &lt;/select&gt;
      {AppointmentStaffSelect_stop}
          )
  
      [1] =&gt; Array
          (
              [0] =&gt; AppointmentStaffSelect
          )
  
  )
  </code></pre>
  
  <p><strong>Small portions that are processed fine</strong></p>
  
  <pre><code>{AppointmentStaffSelect_start}
      &lt;label for="apptCreateEditStaff" class="select required" required&gt;With: &lt;/label&gt;
      &lt;select name="apptCreateEditStaff" id="apptCreateEditStaff" data-native-menu="true" class="select required" required&gt;
          &lt;option value="" data-service="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
  
          &lt;option data-service="{Services}" value="5490"
          &gt;Brian&lt;/option&gt;
          &lt;option data-service="{Services}" value="4388"
          &gt;Mckenna&lt;/option&gt;
          &lt;option data-service="{Services}" value="4387"
          &gt;Katelyn&lt;/option&gt;
          &lt;option data-service="{Services}" value="783"
          &gt;David&lt;/option&gt;
          &lt;option data-service="{Services}" value="4389"
          &gt;Ryan&lt;/option&gt;
          &lt;option data-service="{Services}" value="4394"
          &gt;Ryan - c&lt;/option&gt;
          &lt;option data-service="{Services}" value="784"
          &gt;Tami&lt;/option&gt;
          &lt;option data-service="{Services}" value="4390"
          &gt;Jake&lt;/option&gt;
      &lt;/select&gt;
      {AppointmentStaffSelect_stop}
      &lt;p&gt;{Test}&lt;/p&gt;
  {AppointmentTest_start}
  &lt;p&gt;&lt;/p&gt;
  {AppointmentTest_stop}
  
      &lt;label for="service_id" class="select required"&gt;Service: &lt;/label&gt;
      &lt;select name="service_id" id="service_id" data-native-menu="true" class="select required" required&gt;
          &lt;option value="" data-placeholder="true" data-duration="0" data-cost="0.00"&gt;Choose One&lt;/option&gt;
          &lt;option value="1174|30 Minute Gaming Pass" class="{Classes}" data-cost="3.00" data-duration="30"&gt;30 Minute Gaming Pass&lt;/option&gt;
          &lt;option value="1176|1 Hour Gaming Pass" class="{Classes}" data-cost="5.00" data-duration="60"&gt;1 Hour Gaming Pass&lt;/option&gt;
          &lt;option value="1177|2 Hour Gaming Pass" class="{Classes}" data-cost="7.00" data-duration="120"&gt;2 Hour Gaming Pass&lt;/option&gt;
      &lt;/select&gt;
  
      {AppointmentAddonService_start}
      &lt;fieldset data-role="controlgroup" id="apptCreateEditAddonServicesFieldset"&gt;
          &lt;legend&gt;Add-on Service(s):&lt;/legend&gt;
  
          &lt;input type="checkbox" name="aos-5059" id="aos-5059" data-duration="30" data-cost="10.00" class="custom {Classes}"   /&gt;
          &lt;label for="aos-5059" class="{Classes}"&gt;Unlimited Snack Bar&lt;/label&gt;
  
          &lt;input type="checkbox" name="aos-5060" id="aos-5060" data-duration="30" data-cost="5.00" class="custom {Classes}"   /&gt;
          &lt;label for="aos-5060" class="{Classes}"&gt;Unlimited Energy Drinks&lt;/label&gt;
  
          &lt;input type="checkbox" name="aos-5061" id="aos-5061" data-duration="30" data-cost="1.00" class="custom {Classes}"   /&gt;
          &lt;label for="aos-5061" class="{Classes}"&gt;Candy Bar&lt;/label&gt;
  
      &lt;/fieldset&gt;
      {AppointmentAddonService_stop}
  </code></pre>
  
  <p><strong>Result from small portion page</strong></p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [0] =&gt; {AppointmentStaffSelect_start}
      &lt;label for="apptCreateEditStaff" class="select required" required&gt;With: &lt;/label&gt;
      &lt;select name="apptCreateEditStaff" id="apptCreateEditStaff" data-native-menu="true" class="select required" required&gt;
          &lt;option value="" data-service="" data-placeholder="true"&gt;Choose One&lt;/option&gt;
  
          &lt;option data-service="{Services}" value="5490"
          &gt;Brian&lt;/option&gt;
          &lt;option data-service="{Services}" value="4388"
          &gt;Mckenna&lt;/option&gt;
          &lt;option data-service="{Services}" value="4387"
          &gt;Katelyn&lt;/option&gt;
          &lt;option data-service="{Services}" value="783"
          &gt;David&lt;/option&gt;
          &lt;option data-service="{Services}" value="4389"
          &gt;Ryan&lt;/option&gt;
          &lt;option data-service="{Services}" value="4394"
          &gt;Ryan - c&lt;/option&gt;
          &lt;option data-service="{Services}" value="784"
          &gt;Tami&lt;/option&gt;
          &lt;option data-service="{Services}" value="4390"
          &gt;Jake&lt;/option&gt;
      &lt;/select&gt;
      {AppointmentStaffSelect_stop}
              [1] =&gt; {AppointmentTest_start}
  &lt;p&gt;&lt;/p&gt;
  {AppointmentTest_stop}
              [2] =&gt; {AppointmentAddonService_start}
      &lt;fieldset data-role="controlgroup" id="apptCreateEditAddonServicesFieldset"&gt;
          &lt;legend&gt;Add-on Service(s):&lt;/legend&gt;
  
          &lt;input type="checkbox" name="aos-5059" id="aos-5059" data-duration="30" data-cost="10.00" class="custom {Classes}"   /&gt;
          &lt;label for="aos-5059" class="{Classes}"&gt;Unlimited Snack Bar&lt;/label&gt;
  
          &lt;input type="checkbox" name="aos-5060" id="aos-5060" data-duration="30" data-cost="5.00" class="custom {Classes}"   /&gt;
          &lt;label for="aos-5060" class="{Classes}"&gt;Unlimited Energy Drinks&lt;/label&gt;
  
          &lt;input type="checkbox" name="aos-5061" id="aos-5061" data-duration="30" data-cost="1.00" class="custom {Classes}"   /&gt;
          &lt;label for="aos-5061" class="{Classes}"&gt;Candy Bar&lt;/label&gt;
  
      &lt;/fieldset&gt;
      {AppointmentAddonService_stop}
          )
  
      [1] =&gt; Array
          (
              [0] =&gt; AppointmentStaffSelect
              [1] =&gt; AppointmentTest
              [2] =&gt; AppointmentAddonService
          )
  
  )
  </code></pre>
  
  <p>How do I get it to parse the entire page and return all the matches? The small portions are parsing fine but when I try and search the entire page, it only seems to return the results before the first <code>{Test}</code> token.</p>