Regular expression to get data between two strings in java : <p>I am trying to get data between the two strings "Account:" and "Account" from the below string using regular expression.</p>

<pre><code>    String str= "Order Confirmation Account: Sample Account ID: 1111"
</code></pre>

<p>The regular expression I used is:</p>

<pre><code>    Pattern pattern = Pattern.compile("Account:(.*)Account");
    Matcher matcher = pattern.matcher(str);
    System.out.println("Account name is:"+matcher.group(1));
</code></pre>

<p>The actual output I get is:</p>

<pre><code>java.lang.IllegalStateException: No match found
at java.util.regex.Matcher.group(Unknown Source)
at WorkingProgram$1.run(WorkingProgram.java:102)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
</code></pre>

<p>The expected output is:</p>

<pre><code>Sample
</code></pre>

<p>What is wrong with my regular expression?</p>
