Skills for replacing a function with a regular expression link: replacing a function with a regular expression

Source: Internet
Author: User

Skills for replacing a function with a regular expression link: replacing a function with a regular expression

The following describes how to replace a function with a regular expression link:

1)

Character before a string <a href = "http://www.aaa.cn/000011.html"> Any length character </a>

Replace with the previous character <a href = "http://www.bbb.cn/folder/show.asp? Id = 000011 "> Any character in length </a>

2)

Character before a string <a href = "http://www.aaa.cn/070006,ccc.html"> Any length character </a>

Replace with the previous character <a href = "http://www.bbb.cn/folder/aa.asp? Id = 000011 "> Any character in length </a>

3) if not, delete the link directly.

Character before a string <a href = "http://www.aaa.cn/dddd.html"> Any length character </a>

Replace it with the character following any length

The function style is as follows. Help write regular expressions. Thank you.

Function ScriptHtml (Byval ConStr, FType) Dim Re Set Re = new RegExp Re. ignoreCase = true Re. global = True Select Case FType Case 1 Re. pattern = "Regular Expression" ConStr = Re. replace (ConStr, "") Case 2 Re. pattern = "Regular Expression" ConStr = Re. replace (ConStr, "") Case other End Select ScriptHtml = ConStr Set Re = NothingEnd Function

The above content is about the regular expression link replacement function, and I hope you will like it.

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.