I have common meta tags like that:
<meta id="1" name="keywords" content="some keywords" />
My APP is writen in NodeJs and I need to extract all attributes like that:
[
id: "1",
name: "keywords",
content: "some keywords",
]
I have folowing regex:
var attrsRegex = new RegExp(/\s(.*?)=["'](.*?)["']/gi);
var attrs = attrsRegex.exec('<meta name="author" content="Alza a.s." />');
console.log(attrs);
The code return only the first attribute:
[" id="1"", "id", "1", index: 5, input: "<meta id="1" name="keywords" content="some keywords" />"]
It seems the G
flag doesnt work.?