Efficient method to retrieve a single, specific digit from a text file in Java
<p>My apologies if this question has already been asked before; I tried searching and did not find anything close to this.</p>

<p>I have a text file that I have read into a <code>String</code> in my Java program. I need to search that text file for a particular phrase, which contains a digit, and extract that digit for saving into an <code>int</code> variable. Here is a sample excerpt from one such file:</p>

<pre><code>≥                                                                              ≥
≥CREDIT CARD TERMS                                                             ≥
≥ORDER IS ON HOLD FOR PREPAYMENT OF ORDER TOTAL + FREIGHT BY CREDIT CARD.      ≥
≥ORDER TOTAL DOES NOT REFLECT FREIGHT COSTS &amp; WILL BE CHARGED AFTER ORDER      ≥
≥SHIPS. ORDER WILL SHIP _5_ WORKING DAYS FROM RECEIPT OF ALL APPROVALS &amp;       ≥
≥RECEIPT OF CREDIT CARD FORM.                                                  ≥
≥                                                                              ≥
</code></pre>

<p>This snippet generally appears far down in the text file, but on on specific line. I need to extract the number <code>5</code> from the phrase "<code>ORDER WILL SHIP _5_ WORKING DAYS</code>" from the file.</p>

<p>I can already imagine one way of doing it, which comprises of two consecutive searches with regular expressions. The first would search for the phrase, then the second would search for the number. However, this seems rather inefficient to me, having to create instances of the <code>Pattern</code> and <code>Matcher</code> classes in both processes.</p>

<p>I think there must be some--more efficient--way of performing this extraction without the need for two RegEx searches. Is there such a way? Or is the only way to do this with those two consecutive searches?</p>

<p><em>AMENDMENT 03/30/2016:</em> I neglected to mention that there <strong>might not</strong> be underscores surrounding the number I need to extract. This might affect any answer that doesn't use RegExes.</p>