选择显示字体大小

一个新版本的ubb转化程序

    
  记得以前贴过一个ubb代码转换为html格式的代码,前几天读ubb的源代码。所以有了这个新的版本。注意,这个版本可能还不能正常使用,详细见注。
  这段代码将用户输入的ubb代码转化为html格式,注意,需要script engine 5.0的支持(使
  用了regexp对象)
  
  [b]注:pattern中使用()将知道regexp记忆搜索到的值,$1是第一个(),其余类推。但$2的
  语法并不被5.0版本的vbscript.dll所支持,我检查了自己机器上的版本(安装过ie 5.5),
  发现vbscript.dll的版本为5.50.4629,最后修改日期为12月25日。该版本支持$1之类的语
  法,这个简单的改进使regexp的功能逐渐与perl的正则表达式靠近[/b]
  function ubbcode(strcontent)
  
  
   dim objregexp
   set objregexp=new regexp
   objregexp.ignorecase =true
   objregexp.global=true
   'url
   objregexp.pattern="(\[url\])(http:\/\/\s+?)(\[\/url\])"
   strcontent= objregexp.replace(strcontent,"<a href=""$2""
  target=_blank>$2</a>")
   objregexp.pattern="(\[url\])(\s+?)(\[\/url\])"
   strcontent= objregexp.replace(strcontent,"<a href=""http://$2""
  target=_blank>$2</a>")
   'email
   objregexp.pattern="(\[email\])(\s+\@\s+?)(\[\/email\])"
   strcontent= objregexp.replace(strcontent,"<a
  href=""mailto:$2"">$2</a>")
  
   objregexp.pattern="(\[img\])(\s+?)(\[\/img\])"
   strcontent=objregexp.replace(strcontent,"<img src=""$2"">")
  
   objregexp.pattern="(\[quote\])(.+?)(\[\/quote\])"
   strcontent=objregexp.replace(strcontent,"<blockquote><font size=1
  face=""verdana, arial"">quote:</font><hr>$2<hr></blockquote>")
  
   objregexp.pattern="(\[i\])(.+?)(\[\/i\])"
   strcontent=objregexp.replace(strcontent,"<i>$2</i>")
  
   objregexp.pattern="(\[b\])(.+?)(\[\/b\])"
   strcontent=objregexp.replace(strcontent,"<b>$2</b>")
   set objregexp=nothing
   ubbcode=strcontent
  end function
  原版的转化程序,摘自freeware版本的ubb论坛,可到
  http://www.ultimatebb.com/下载(perl cgi方式)
  sub ubbcode {
  
  my $thepost = shift;
  $thepost =~ s/(\[url\])(http:\/\/\s+?)(\[\/url\])/ <a href="$2"
  target=_blank>$2<\/a> /isg;
  
  $thepost =~ s/(\[url\])(\s+?)(\[\/url\])/ <a href="http:\/\/$2"
  target=_blank>$2<\/a> /isg;
  
  $thepost =~ s/(\[email\])(\s+\@\s+?)(\[\/email\])/ <a
  href="mailto:$2">$2<\/a> /isg;
  
  if (($ubbimages eq "on") && ($overrideimages ne "yes")) {
  $thepost =~ s/(\[img\])(\s+?)(\[\/img\])/ <img src="$2"> /isg;
  }
  
  
  $thepost =~ s/(\[quote\])(.+?)(\[\/quote\])/ <blockquote><font size="1"
  face="verdana, arial">quote:<\/font><hr>$2<hr><\/blockquote>/isg;
  
  $thepost =~ s/(\[i\])(.+?)(\[\/i\])/<i>$2<\/i>/isg;
  
  $thepost =~ s/(\[b\])(.+?)(\[\/b\])/<b>$2<\/b>/isg;
  
  return ($thepost);
  
  }
  学习asp的同志,不要放弃对cgi的学习,特别是一些老外的cgi程序,看后对我们的asp编程
  会有很大的启发
  
  
    


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons