title: How to get data from page source using java and jsoup
body: <p>How can I get the values <em>$23,000,000</em> and <em>$47,351,251</em> from the 
  following page source? 
  I want to get only these values from the source code, but I'm not sure the best way to do it.</p>
  
  <pre><code>  &lt;div class="txt-block"&gt;
              &lt;h4 class="inline"&gt;Budget:&lt;/h4&gt;$23,000,000
              &lt;span class="attribute"&gt;(estimated)&lt;/span&gt;
          &lt;/div&gt;
  
          &lt;div class="txt-block"&gt;
              &lt;h4 class="inline"&gt;Opening Weekend USA:&lt;/h4&gt; $260,382,
  &lt;span class="attribute"&gt;20 December 2013&lt;/span&gt;, &lt;span class="attribute"&gt;Limited Release&lt;/span&gt;
          &lt;/div&gt;
  
          &lt;div class="txt-block"&gt;
  &lt;h4 class="inline"&gt;Gross USA:&lt;/h4&gt; $25,568,251
          &lt;/div&gt;
          &lt;div class="txt-block"&gt;
  &lt;h4 class="inline"&gt;Cumulative Worldwide Gross:&lt;/h4&gt; $47,351,251
          &lt;/div&gt;
  </code></pre>
  
  <p>I tried like this:</p>
  
  <pre><code>    String url = "https://www.imdb.com/title/tt1798709";
      Connection connection = Jsoup.connect(url);
      Document document = connection.get();
      Elements element = document.getElementsByClass("txt-block");
  
  
      String gross = "";
      String budget = "";
  
      String budgetRegex = "Budget:.*";
      String grossRegex = "Cumulative Worldwide Gross:.*";
  
      for (Element e : element) {
          if (e.text().matches(budgetRegex)) {
              String text = e.text();
              budget = StringUtils.substringBetween(text, "$", " ");
              break;
          } else {
              budget = null;
          }
      }
      for (Element e : element) {
          if (e.text().matches(grossRegex)) {
              String text = e.text();
              gross = StringUtils.substringAfter(text, "$");
                  break;
          } else {
              gross = null;
          }
  
      }
      System.out.println(gross + ", " + budget);
  </code></pre>
  
  <p>It's working, but is there a better solution?</p>