on-internet
← Community

Selecting all instances of an Anchor tag using a regular expression

Stack Overflow ·

Problem: My goal is to, given any HTML text as input to my Bash script, the output will be an array of all the links. Given this input: ... <div> <span></span> <span>launching on <strong>Nov 25</strong></span> </div> <a ...> <figure class="item-view-box relative"> <div ...> <div ...></div> ... </div> </a> <div ...> <a ...> <figure class="item-view-box relative"> <div ...> <div ...></div> ... </div> </a> </div> <div> <span></span> <span>launching on <strong>Nov 25</strong></span> </div> ... The output should be an array as follows: ["<a ...> ... </a>", "<a (different one right after) ...> ... <

Comments

Sign in or sign up to comment and upvote.

No comments yet.