Skip to content

Instantly share code, notes, and snippets.

@jberger
Created September 9, 2021 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jberger/94783fd9458af39f25b6360d62d8c954 to your computer and use it in GitHub Desktop.
Save jberger/94783fd9458af39f25b6360d62d8c954 to your computer and use it in GitHub Desktop.
use Mojo::Base -strict;
use Mojo::DOM;
my $html = q!<img src='/__swift/themes/admin_default/images/mimeico_blank.gif' valign='middle' style='position: relative; top: -1px;'> <a href='https://paster.reflected.net/get/665cb7a9-0735-47c9-a33e-3cad17d0b730'><strong>prometheus.20200605.yml</strong></a>!;
my $dom = Mojo::DOM->new($html);
my $anchor = $dom->at('a');
my $href = $anchor->{href};
my $name = $anchor->all_text;
say "$name - $href";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment