title: Regex: match number in table cell
body: <p>I have following table cell:</p>
  
  <pre><code>&lt;td class="text-right"
                  onmouseenter="$(this).find('.overlay-viewable-box:first').show();"
                  onmouseleave="$(this).find('.overlay-viewable-box:first').hide();"&gt;
  
  
  
  
                  2.004
  
  
  
  
  
              &lt;/td&gt;
  </code></pre>
  
  <p>It contains spaces and line breaks too. The class="text-right" isn't unique on the page, but the first - if it could help to relate on it.</p>
  
  <p><strong>I want to match only number</strong> (this one - 2.004, or any other, it is always only one number) - with or without the point and/ or comma in it.</p>
  
  <p><strong>PS</strong>: yes, i fully agreed that the idea to parse html with regex is not the best - any other method would be such kind of overhead, that it would be not worth to do:( </p>
  
  <p>PPS: guys and guls - please write your recommendations as answers, not as comments, so i could accept and honorate them.</p>
  
  <p><strong>Solution</strong>: <code>(?:&lt;td\b.*?text-right\b.*?\D*?;"&gt;)([\s\S\d]*?)(?=\D*?&lt;\/)</code></p>
  
  <p><strong>Edit</strong>: full length HTML:</p>
  
  <pre><code>&lt;div class="box    " &gt;
  
          &lt;div class="box-head    " &gt;
              &lt;div class="box-icon"&gt;
              &lt;span class="icon "&gt;&amp;#xf0ae;&lt;/span&gt;        &lt;/div&gt;
          &lt;span class="divider"&gt;&lt;/span&gt;
  
                      &lt;div class="box-title box-title-space-1"&gt;
              &lt;span&gt;Keyword-Profile&lt;/span&gt;&lt;/div&gt;
  
      &lt;div class="box-options dropdown  box-options-no-divider"&gt;
  
  
              &lt;div class="divider "&gt;&lt;/div&gt;
          &lt;div class="box-icon "&gt;&lt;a
                      class="button"&gt;
                  &lt;span class="icon "&gt;&amp;#xf013;&lt;/span&gt;            &lt;/a&gt;&lt;/div&gt;
  
          &lt;ul class="dropdown-menu"&gt;
  
  
                                  &lt;li
                                      &gt;                        &lt;a   onclick="" class="modal"&gt;&lt;div&gt;&lt;div class="icon"&gt;&lt;div&gt;&amp;#xf055;&lt;/div&gt;&lt;/div&gt;&lt;div class="text"&gt; Add to Dashboard&lt;/div&gt;&lt;/div&gt;&lt;/a&gt;
                                      &lt;/li&gt;
  
                                  &lt;li
                                      &gt;&lt;span class="box-menu-seperator"&gt;&lt;/span&gt;                        &lt;a   onclick="
                                                                                  " href="" class="modal"&gt;&lt;div&gt;&lt;div class="icon"&gt;&lt;div&gt;&amp;#xf055;&lt;/div&gt;&lt;/div&gt;&lt;div class="text"&gt; Add to Report&lt;/div&gt;&lt;/div&gt;&lt;/a&gt;
                                      &lt;/li&gt;
  
          &lt;/ul&gt;
  
  &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;div class="module-loading-blocker"&gt;
      &lt;div class="module-loading-blocker-icon"&gt;
          &lt;div style="width: 40px; height: 40px; display: inline-block;"&gt;
      &lt;svg width="100%" height="100%" class="loading-circular" viewBox="0 0 50 50"&gt;
          &lt;circle class="loading-path" cx="25" cy="25" r="20" fill="none" stroke-width="5" stroke-miterlimit="10"/&gt;
      &lt;/svg&gt;
  &lt;/div&gt;    &lt;/div&gt;
  &lt;/div&gt;
      &lt;div class="box-content box-body box-table" &gt;    &lt;table class="table table-spaced"&gt;
              &lt;tr&gt;
              &lt;td&gt;
  
  
  
  
                              Top-10
  
  
  
  
  
              &lt;/td&gt;
  
              &lt;td class="text-right"
                  onmouseenter="$(this).find('.overlay-viewable-box:first').show();"
                  onmouseleave="$(this).find('.overlay-viewable-box:first').hide();"&gt;
  
  
  
  
                  2.004
  
  
  
  
  
              &lt;/td&gt;
          &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td&gt;
  
  
  
  
                              Top-100
  
  
  
  
  
              &lt;/td&gt;
  
              &lt;td class="text-right"
                  onmouseenter="$(this).find('.overlay-viewable-box:first').show();"
                  onmouseleave="$(this).find('.overlay-viewable-box:first').hide();"&gt;
  
  
  
  
                  237.557
  
  
  
  
  
              &lt;/td&gt;
          &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td&gt;
  
  
  
  
                              &amp;empty; Position
  
  
  
  
  
              &lt;/td&gt;
  
              &lt;td class="text-right"
                  onmouseenter="$(this).find('.overlay-viewable-box:first').show();"
                  onmouseleave="$(this).find('.overlay-viewable-box:first').hide();"&gt;
  
  
  
  
                  60
  
  
  
  
  
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;/table&gt;
  &lt;/div&gt;&lt;/div&gt;&lt;div class="module" style="display: none;"&gt;x&lt;/div&gt;
  </code></pre>