Using the official spec for the HTML5 srcset image candidate string, I've created the following regex:
/<img[^\>]*[^\>\S]+srcset=['"](?:([^"'\s,]+)\s*(?:\s+\d+[wx])(?:,\s*)?)+["']/gm
...Which should match the following tag:
<img srcset="[email protected] 2x, [email protected] 4x, [email protected] 6x">
...And return the three filenames specified ([email protected]
, [email protected]
, [email protected]
).
However, even though it matches, it's only returning the last one. See this Regex101 demo.
What am I doing wrong?