BBS裡UBB的全碼

2021-04-02 13:32:37 字數 1675 閱讀 8044

bbs裡ubb的全碼

function out(str)

out=server.htmlencode(str)

out=replace(out,vbcrlf,"

")out=ubbcode(out,"/[img/](.*?)/[//img/]","

out=ubbcode(out,"/[img align=left/](.*?)/[//img/]","

out=ubbcode(out,"/[img align=right/](.*?)/[//img/]","

out=ubbcode(out,"/[img align=center/](.*?)/[//img/]","

")out=ubbcode(out,"/(.*?)/[//color/]","$2")

out=ubbcode(out,"/[url=(.*?)/](.*?)/[//url/]","$2")

out=ubbcode(out,"/[url/](.*?)/[//url/]","$1")

out=ubbcode(out,"/[center/](.*?)/[//center/]","$1")

out=ubbcode(out,"/[b/](.*?)/[//b/]","$1")

out=ubbcode(out,"/[i/](.*?)/[//i/]","$1")

out=ubbcode(out,"/[u/](.*?)/[//u/]","$1")

out=ubbcode(out,"/[h1/](.*?)/[//h1/]","")

out=ubbcode(out,"/[h2/](.*?)/[//h2/]","")

out=ubbcode(out,"/[h3/](.*?)/[//h3/]","")

out=htmlcode(out)

end function

%>

function htmlcode(str)

set re=new regexp

re.ignorecase=true

re.global=true

re.pattern="(?:^|>)(?:.*?)(?:

set searchs=re.execute(str)

for each search in searchs

s=replace(search.value," "," ")

str=replace(str,search.value,s)

next

htmlcode=str

end function

%>

function ubbcode(str1,str2,str3)

set re = new regexp

re.ignorecase = true

re.global = true

re.pattern = str2

ubbcode = re.replace(str1,str3)

end function

%>