This regex is very handy when we want to parse html tags and use them in our code
Regex reSrc = new Regex(@"src=(?:(['""])(?<src>(?:(?!\1).)*)\1|(?<src>[^\s>]+))", RegexOptions.IgnoreCase | RegexOptions.Singleline);
Match mSrc = reSrc.Match(htmlImageTag);
if (!string.IsNullOrEmpty(mSrc.Groups["src"].Value))
{
string imageUrl = mSrc.Groups["src"].Value;
}
Refer:http://www.experts-exchange.com/Programming/Languages/Regular_Expressions/Q_23964786.html
Regex reSrc = new Regex(@"src=(?:(['""])(?<src>(?:(?!\1).)*)\1|(?<src>[^\s>]+))", RegexOptions.IgnoreCase | RegexOptions.Singleline);
Match mSrc = reSrc.Match(htmlImageTag);
if (!string.IsNullOrEmpty(mSrc.Groups["src"].Value))
{
string imageUrl = mSrc.Groups["src"].Value;
}
Refer:http://www.experts-exchange.com/Programming/Languages/Regular_Expressions/Q_23964786.html
No comments:
Post a Comment