I have an HTML page source which is in string format on the server-side
I need to extract a from the string and add it to an array.There can be multiple links with the same starting tag. i need to push the extracted string to an array
the <link rel="icons"................ >
can contain anything inside the tag.I have mentioned the startTag and endTag in the code below.
var startTag = '<link rel="icons"';
var endTag = '>';
const re = new RegExp('(' + startTag + ')(.|\n)+?(' + endTag + ')', 'g');
However, When i console the value of re, it is not the one I expect.
DesiredOutput
['<link rel="icons" href="icons1.png"','<link rel="icons" href="icons2.png"',<link rel="icons" href="icons3.png"]
Thanks in advance.