I recently saw someone asking me in the garden how to extract the edited image from the FCKeditor editor. In fact, it is very easy to write a regular expression.
CodeAs follows:
Public Static String [] Gethtmlimageurllist ( String Shtmltext)
{
// Define a regular expression to match the IMG tag
RegEx regimg = New RegEx ( @" ] *? \ Bsrc [\ s \ t \ r \ n] * = [\ s \ t \ r \ n] * ["']? [\ S \ t \ r \ n] * (? [^ \ s \ t \ r \ n "" '<>] *) [^ <>] *? /? [\ S \ t \ r \ n] *> " , Regexoptions. ignorecase );
// Search for matched strings
Matchcollection matches = Regimg. Matches (shtmltext );
Int I = 0 ;
String [] Surllist = New String [Matches. Count];
// Retrieve the matching item list
Foreach (Match In Matches)
Surllist [I ++ ] = Match. Groups [ " Imgurl " ]. Value;
Return Surllist;
}
Each item in the returned array is the URL of the image in the editor. Haha !!