0

I'm trying to get value of a href attribute from an anchor tag (a tag) using Java, without a third party API. I know the class of the label. The website looks like this:

<html>
  <body>
    <div id="uix_wrapper">
      <div id="button">
          <label class="downloadButton">
            <a href="link that I want to get">Button</a>
          </label>
      </div>
    </div>
  </body>
</html>
bramhaag
  • 135
  • 1
  • 1
  • 18

1 Answers1

0

You can use a regular expression if you try to avoid using any third-party libraries. A very basic expression for your example is

<a href="(.*?)">

and should work. You can try out yourself using https://www.debuggex.com/

The result will be in the second group.

Florian
  • 1,142
  • 1
  • 9
  • 21
  • 2
    Uh, read [classical regex and html question and answer](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags). – RealSkeptic Jul 08 '15 at 13:26