Using Perl to strip everything from a string except HTML Anchor Links

Using Perl, how can I use a regex to take a string that has random html in it with one html link with anchor, like this:

  <a href="" target="_blank">Whatever Example</a>

and it leave ONLY that and get rid of everything else? No matter what was inside the href link with the <a, like title=, or style=, or whatever.
and it leave the anchor: “Whatever Example” and the </a>?

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.