i try to parse a html page which a have loaded with perl. i need to get the src="asd/jkl/xyz.css" for example out of the html-repsone to manipulate the path to an absolute.
the reason why i want to do this is, that is need the css inline in a E-Mail head ...
so my try to realize this is:
- load the page via perl
- get the src of the linked css
- load the css files via perl
- parse the css und put the contents of the css files in the head-tag of my generated email.
has anyone a better idea or a working regex?
<link rel="stylesheet" href="foo.css">and<link href="foo.css" rel="stylesheet">, for example. Having said that, it is rarely a good idea to parse HTML with regex. Use a real HTML parser as tenub suggested.