Asp.net c # regular image address

Source: Internet
Author: User
Tags recode

Asp.net c # regular image address this uses the Regular Expression in asp.net c # to recode all the image addresses in the string and replace it with the address we want to connect.

Asp tutorial. net c # regular image address
This uses the regular expression in the asp.net tutorial c # to recode all the image addresses in the string and replace it with the address we want to connect.
*/

Public static string getimgurl (string htmlstr)
{

String str = string. empty;
String spattern = @ "^ ] *> ";
Regex r = new regex (@ "] * s * srcs * = s * ([']?) (? <Url> s + )'? [^>] *> ", Regexoptions. compiled );
Match m = r. match (htmlstr. tolower ());
If (m. success)
{
Str = m. result ("$ {url }");

}
Else
{
Str = "images/scroll_18.jpg ";
}
Str. replace ("www.123.cc", "www. bKjia. c0m ");
Return str;


}

Related Article

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.