The application of regular expression in Network programming (5)

Source: Internet
Author: User
Three, ubb regular expression template instance
Here's a ubb function I wrote that basically makes your forum an excellent UBB code forum. Of course, by improving, you can get a more powerful UBB forum.
Function Rethestr (FACE,STR)
Dim re,str
Re= ">"
Str=checkexp (Re,str, ">")
"Re="
Str=checkexp (Re,str, "<")
Re= "/"
Str=checkexp (Re,str, "<p>")
RE=CHR (32)
Str=checkexp (Re,str, "")
Re= ""
Str=checkexp (Re,str, "")
re= [img] ((http: (//|\)) {1} ((W) +[.]) {1,3}_
(NET|COM|CN|ORG|CC|TV) (((/[~]*| [~]*)
(w) +) | [.] (w) +) * (W) +[.] {1} (gif|jpg|png)) [/IMG] "' Find a picture address
Str=checkexp (Re,str, "Re= "[W] (http: (//|\) ((w) +[.]) {1,}_
(NET|COM|CN|ORG|CC|TV) (((/[~]*| [~]*) (W) +) | [.] (w) +) *
(((([?] (w) +) {1}[=]*)) * ((W) +) {1} ([+] (W) +[=] (w) +) *) *) [/w] "' Find frame Address
Str=checkexp (Re,str, "<iframe width= ' height= ' src= ' $ '" ")
Re= "([^ (']])" (<br>) * (HTTP|HTTPS|FTP): _
(//|\) ((W) +[.]) {1,} (net|com|cn|org|cc|tv|_
([0-9]{1,3})] (((/[~]*| [~]*) (W) +) | [.] (w) +) *_
(((([?] (w) +) {1}[=]*)) * ((W) +) {1} ([+] (W) +[=] (w) +) *) "' Find link address
Str=checkexp (Re,str, "$1$2 <a Href= ' $ ' target=_blank>$3 </a>")
Re= "([^ (http://|http:)]) ((WWW|CN) [.] (w) +[.] {1,}_
(NET|COM|CN|ORG|CC) (((/[~]*| [~]*) (W) +) | [.] (w) +) *
(((([?] (w) +) {1}[=]*)) * ((W) +) {1} ([[] (W) +[=] (w) +) *) *)
"' Find an address that does not start with http://
Str=checkexp (Re,str, "<a Href= ' http://$2 ' target=_blank>$2 </a>")
Re= "([^ (=)]) ((w) +[@]{1} ((W) +[.]) {1,3} (w) +) "' Find mailing address
Str=checkexp (Re,str, "<a Href= ' mailto:$2 ' >$2 </a>")
Re= "[Color= ((w) +) |] [#] [0-f] {6})] ((.) +) [/color] "' Replaces font color
Str=checkexp (Re,str, "<font color= ' >$4 </font>")
Re= "[Size= (][0-9]{1})] ((.) +) [/size] ' Replace font size

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.