How to extract the edited image from FCKeditor in ASP. NET

Source: Internet
Author: User

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 !!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.