I have an iframe in a string, as below:
let data = "<iframe src=\"https://example.com/3380098/test/embed\" height=\"500\" width=\"100%\" style=\"border:0\"></iframe>"
My goal is to extract the number '3380098'
from the src.
And I am stuck with parsing it.
Here is my approach:
var parser = new DOMParser();
var parsedIframe = parser.parseFromString(data, "text/html");
let iFrame = parsedIframe.getElementsByTagName("iframe");
But from here on, I am unable to get the src of the iframe. Please help.
This question is different because there is no real iframe, it's a string.