title: Regex/Java - How to capture the five digits after String in a dynamic table
body: <p>I have below table where I am reading entire row if it matches the mobile number "00955555555555" and need to get the code "89721".</p>
  
  <pre><code>table border="2" cellspacing="0" width="100%" cellpadding="0"&gt;
  </code></pre>
  
  <p>
      <b>&nbsp;Mobile Number</b>
      <b>&nbsp;Date</b>
      <b>&nbsp;Message</b>
  </p>
  
  <p> </p>
  
  <pre><code>&lt;td align="left" nowrap&gt;&lt;font face="times new roman" size=3 &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;00955555555555&lt;/font&gt;&lt;/td&gt;
  &lt;td align="left" nowrap&gt;&lt;font face="times new roman" size=3 &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;2017-04-17 17:34:06.72&lt;/font&gt;&lt;/td&gt;
  &lt;td align="left"&gt;&lt;font face="times new roman" size=3 &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Your authentication code is  89721 to add name as beneficiary for payment from your account. If you have not requested to add this beneficiary, please contact the bank 
  </code></pre>
  
  <p>IMMEDIATELY on 00971 600 54 0000.
      </p>
  
  <p></p>
  
  <pre><code>&lt;td align="left" nowrap&gt;&lt;font face="times new roman" size=3 &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;955111111111&lt;/font&gt;&lt;/td&gt;
  &lt;td align="left" nowrap&gt;&lt;font face="times new roman" size=3 &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;2017-04-17 17:31:13.893&lt;/font&gt;&lt;/td&gt;
  &lt;td align="left"&gt;&lt;font face="times new roman" size=3 &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Your authentication code is: 91518. Please do not share this code with any person.&lt;/font&gt;&lt;/td&gt;
  &lt;tr&gt;
  </code></pre>
  
  <p>I have tried below code but it returns the mobile number but not the five digit code. </p>
  
  <p>Code :</p>
  
  <pre><code>public String entire_row_is_read_which_matches_with_the_Mobile_number() throws Throwable {
  
  String mobilenumber="00955555555555"; 
  
  
  //Date validate = null;
          {
              List&lt;WebElement&gt; rows = driver1.findElements(By.cssSelector("tr"));
              for (WebElement row : rows)
              {
                  String text = row.getText();
                  if (text.contains(mobilenumber))
                  {
                     String regex = " (\\d+)"; //Your authentication code is
  
                     System.out.println(regex);
  
                      Pattern pattern = Pattern.compile(regex);
                      Matcher matcher = pattern.matcher(text);
  
                      if (matcher.find())             
                           {
  
                          valueis = matcher.group(1); 
                          System.out.println(valueis);
  
                          break;
  
                           }
  </code></pre>