I'm having some problems understanding the regex pattern syntax.
I'm using Outlook interop
to go through the HTMLbody
of an email.msg.
I want to remove all the images that has a reference to the internet.
So I'm useing Regex.Replace
to find all image tags and replacing them with text.
This is what, I've:
string altText = " <i>*Reference to picture on the internet removed*</i> ";
string b = Regex.Replace(a, @"(<img([^>]+)>)", altText);
This works, but I want to find the tags that only have src
from the internet.
I found this in my google search:
string matchString = Regex.Match(a, "<img.+?src=[\"'](.+?)[\"'].*?>", RegexOptions.IgnoreCase).Groups[1].Value;
But it will not help since it looks like all images have a src
tag. My goal is to write a pattern syntax if possible in Regex
where i check if the source ( src
) starts with http, https or www.
Is there anyone who can help me with this?