Public static string getimgurl (string htmlstr)
{
String STR = string. empty;
// String spattern = @ "^ ] *> ";
RegEx r = new RegEx (@ "] * \ s * SRC \ s * = \ s * ([']?) (? <URL> \ s + )'? [^>] *> ", // Note (? <URL> \ s +) is handled by groups in regular expressions. It is used in the following code and can be changed to other HTML tags to obtain content in the same way!
Regexoptions. Compiled );
Match m = R. Match (htmlstr. tolower ());
If (M. Success)
STR = M. Result ("$ {URL }");
Return STR;
}
// Returns multiple paths
Public static stringbuilder mygetimgurl (string text)
{
Stringbuilder STR = new stringbuilder ();
String PAT = @ "] * \ s * SRC \ s * = \ s * ([']?) (? <URL> \ s + )'? [^>] *> ";
RegEx R
= New RegEx (Pat, regexoptions. Compiled );
Match m
= R. Match (text. tolower ());
// Int matchcount = 0;
While (M. Success)
{
Group G = M. Groups [2];
Str. append (g). append (",");
M = M. nextmatch ();
}
Return STR;
}