Suppose I have the following HTML elements:
<iframe height="100" width="200" src="https://www.stackoverflow.com/share"></iframe>
<iframe height="100" width="200" src="https://www.google.com/share"></iframe>
<iframe height="100" width="200" src="https://www.yahoo.com/share"></iframe>
I ant to use Regex in order to find the iframe
with a specific src
(has to contain https://www.stackoverflow.com/share/{s}
attribute and get the other attributes associated within this html attribute.
So in this instance, the regex would return:
Group 1: https://www.google.com/share
Group 2: 100
Group 3: 200
I have tried the following:
iframe.*src[^""]+['"]+(https:\/\/www.google.com\/share)
Which finds the specific URL and gives me it the group, no matter where it is within the string.
The issue I'm facing is expanding on this to return all of the other attributes within the HTML element.
I have tried the add the following to the Regex:
\s+width="(.*?)"\s+height="(.*?)"
But this returns no match.
How (possibly), using the current regex that I've formed to get the remaining attributes values using regex?