0

in my C# app I have an html string then with regex matches I get all img tags. Fine, now I'd like to know if src property is relative url or absolute url or a data uri scheme and then to do things according to result. If this is is my html:

<H1>Hello from Test Page</H1>
<IMG src="images/TestImage1.jpg">
 or
<H1>Hello from Test Page</H1>
<IMG src="http://localhost/images/TestImage1.jpg">
 or
<H1>Hello from Test Page</H1>
<IMG src="https://localhost/images/TestImage1.jpg">
 or
<H1>Hello from Test Page</H1>
<IMG src="data:image/jpg|png|gif|...;base64,...">

So, I get src string and verify. Something like:

private bool isDataUri(string src)...
private bool isAbsoluteUrl(string src)...
private bool isRelativeUrl(string src)...

Thank you for your help.

0 Answers0