title: Replace last occurrence of word between 2 words with RegEx
body: <p>I'm working with RegEx on Java and here is where I stuck.</p>
  
  <p>I have a simple string like</p>
  
  <pre><code>String sample1 = "word 231 sadas aslkjasf anything ORDER what whut ASC hello ORDER whatever."
  </code></pre>
  
  <p>I have to find every substring until the last occurrence of <code>ASC</code> between two <code>ORDER</code>s and replace them with word <code>QQQ</code>.</p>
  
  <p>Here are some examples:</p>
  
  <pre><code>String sample1 = "word 231 sadas aslkjasf anything ORDER what whut ASC hello ORDER whatever.";
  String result1 = "word 231 sadas aslkjasf anything QQQ hello ORDER whatever.";
  // replaced "ORDER what whut ASC"
  
  String sample2 = "word 111 sadas anything ORDER what whut yeap ASC nope ASC maybe ORDER yeah.";
  String result2 = "word 111 sadas anything QQQ maybe ORDER yeah.";
  // replaced "ORDER what whut yeap ASC nope ASC"
  </code></pre>