code: public Elements getElementsByAttributeValueMatching(String key, String regex) {
          Pattern pattern;
          try {
              pattern = Pattern.compile(regex);
          } catch (PatternSyntaxException e) {
              throw new IllegalArgumentException("Pattern syntax error: " + regex, e);
          }
          return getElementsByAttributeValueMatching(key, pattern);
      }
docs: Find elements that have attributes whose values match the supplied regular expression.
  @param key name of the attribute
  @param regex regular expression to match against attribute values. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as (?i) and (?m) to control regex options.
  @return elements that have attributes matching this regular expression