title: Regex over a html page
body: <p>Hello I'm trying to select 4 values from a html page (static page of a printer) The thing is i have some issues succeeding. I have  some attempts all fail could you guys help me pls:</p>
  
  <p>hole page = <a href="http://pastebin.com/e7eKAV0x" rel="nofollow">http://pastebin.com/e7eKAV0x</a></p>
  
  <p>code of intresst:</p>
  
  <pre><code>               &lt;tr&gt;                        
                   &lt;td&gt;                      
                     Yellow Cartridge
                     &lt;br&gt;
                     Order 305A (CE412A)
                   &lt;/td&gt;
                   &lt;td class="alignRight valignTop"&gt;  
                           40%
                         †
                   &lt;/td&gt;
                 &lt;/tr&gt;
  </code></pre>
  
  <p>(Please use inspect / check the page) I need the 40% value from 4 different filds(printer colors). When color is  out  <code>--</code></p>
  
  <p>My last try:</p>
  
  <pre><code>public void buildCartigesAndValue(String ipString) throws IOException {
          LOGGER.log(Level.INFO, "Starting mining over IP " + ipString);
          String context = getUrlSource(ipString);
          System.out.println(context); 
  
          urlPart = "/info_colorUsageJobLog.html?tab=Status&amp;menu=ColorUsageLog";
          if (context.contains("HP Color LaserJet CP2025dn") || context.contains("HP Color LaserJet CM2320nf MFP")) {
              LOGGER.log(Level.INFO, "PRINTER TYPE ======= HP Color LaserJet CP2025dn");
              regexColorContent = "\\w+\\W{1}Cartridge (?&lt;!Printer)";
              regexTagContent = "(&lt;td{1}&gt;)([^&lt;]{1}[^.{20}][^&amp;nbsp;&amp;nbsp;].*?)(&lt;/td&gt;)";
          }
          else if (context.contains("HP LaserJet 400 color M451dw")){
              LOGGER.log(Level.INFO, "PRINTER TYPE ======= HP LaserJet 400 color M451dw");
              regexColorContent = "\\w+\\W{1}Cartridge (?&lt;!Printer)";
              regexTagContent = "Cartridge.{50}";
          }
  
          List&lt;Integer&gt; vals = findCartegisProcentr(context);
          List&lt;String&gt; colors = findCartigesColor(context);
          for (int i = 0; i &lt; colors.size(); i++) {
              if (colors.get(i).contains("Printer")) {
                  continue;
              }
              System.out.println(colors.get(i));
              addNewColorVal(colors.get(i), vals.get(i));
          }
          LOGGER.log(Level.INFO, "Stopping sucessfully ---- MAP ---- " + this.colorAmountMap.toString());
      }
  
  
  public List&lt;Integer&gt; findCartegisProcentr(String context) {
      List&lt;Integer&gt; vals = new ArrayList&lt;&gt;();
  
      regexValContent = "\\d{2}|-{2}"; // FOR PARTICULAR THE VALUES
  
      Pattern patternTagContent = Pattern.compile(regexTagContent);
      Matcher matcherTagContent = patternTagContent.matcher(context);
  
      Pattern patternValContent = Pattern.compile(regexValContent);
      while (matcherTagContent.find()) {
          Matcher matcherValContent = patternValContent
                  .matcher(matcherTagContent.group());
          matcherValContent.find();
          try {
              vals.add(Integer.parseInt(matcherValContent.group()));
          } catch (Exception e) {
              vals.add(0);
          }
      }
      return vals;
  }
  </code></pre>