title: Regex to search for two consecutive lines if the second doesn't start with a given word
body: <p>I am trying (in <em>Eclipse</em>, I don't know if the syntax is different there) to write a regex that will select everything from <strong>'service'</strong> up to the next two <strong>';'</strong>, but skipping the search if between the two <strong>';'</strong> there is the word <strong>'assert'</strong>.</p>
  
  <p>This means that in the following example, I would like to select the text <strong>'service.updateBasket.........test();'</strong> and not the text <strong>'service.createBasket.........asserThat.....;'</strong></p>
  
  <pre><code>BasketBean updateBasketRepsonse =
     service.updateBasket(login.getSessionId(),
                          Identity.valueOf(createdbasketBean.getGeneralID()),
                          basketSaveRequestBean);
  
  test();
  
  Response createBasketResponse = service.createBasket(login.getSessionId(),
                                                       basketSaveRequestBean);
  
  assertThat(createBasketResponse).hasStatus(Status.CREATED);
  </code></pre>
  
  <p>So far I've written the regex <code>service\.(.*\R)*?.*;</code>, which finds the text I want till the first <strong>';'</strong>. But I am having problem in handling the search till the next <strong>';'</strong>.</p>
  
  <p>For example <code>service\.(.*\R)*?.*;\R.*;</code> sometimes goes up to the third <strong>';'</strong> (if there is an empty line after the first <strong>';'</strong>)... and I don't understand why.</p>
  
  <p>Especially, I can't seem to find a way to skip the search if the line after the first <strong>';'</strong> starts with <strong>'assertThat'</strong> - that would be my final goal.</p>
  
  <p>Note that the lines I am searching for are CONSECUTIVE, i.e. that the search only has to consider lines where the first <strong>';'</strong> is followed by a line with text... as mentioned above, I am having troubles with that too :(</p>