Forum Moderators: coopster
I want to extract the src links and titles of all the images that do have a title in their <img> tag in an HTML page. The problem is that I don't know if the title attribute of the <img> tag is before, after or separated by other attributes from the src attribute (which contains the URL of the image). I want a regex that matches both the title specified by the "title=" attribute and the URL of the image specified by the "src=" attribute of the same <img> element.
I want it to match the src and title (in two different parenthesized subsets of the regex) if, and only if, both the title and src attributes are present in the <img> element in no specific order relative to each other.
I guess it may require some conditional statement or so.
Any help would be much appreciated!
I myself have very bad regex practice :D but here is the idea,
it must start with <img followed by anything unless it reaches 'title=' and there must be at least one character between the double quotes of title (or single quotes depends on your html) ending on '>'