1. 简单匹配多行
-------------------------------------------------
Set re1 = New regExp
re1.Global = true
re1.IgnoreCase = true
re1.Multiline = false
re1.Pattern = "\[code\]([\s\S]+)\[\/code\]"
str = re1.Replace(str,"$1")
set re1=nothing
2. 对匹配到的内容进行相关操作
-------------------------------------------------
Set re1 = New regExp
re1.Global = true
re1.IgnoreCase = true
re1.Multiline = true re1.Pattern = "\[textarea\]([?:\s\S]+)\[\/textarea\]"
Set Matches = re1.Execute(str)
for each match in Matches
match=replace(match,"<br/>",chr(13))
match=replace(match," ",chr(32))
match=replace(match,"<","<")
match=replace(match,">",">")
match=replace(match,"'","'")
match=replace(match,""",chr(34))
match=replace(match,"[textarea]","<textarea name=""textarea"" cols=""60"" rows=""10"">",1,-1,1)
match=replace(match,"[/textarea]","</textarea><br/><input type=""button"" onclick=""rc()"" value=""running code"" />",1,-1,1)
re1.Pattern = "\[textarea\][\s\S]+\[\/textarea\]"
str = re1.Replace(str,match)
next
set re1=nothing
-------------------------------------------------是不是单行模式不能捕获<br>这些的 如上面的例子
-------------------------------------------------
Set re1 = New regExp
re1.Global = true
re1.IgnoreCase = true
re1.Multiline = false
re1.Pattern = "\[code\]([\s\S]+)\[\/code\]"
str = re1.Replace(str,"$1")
set re1=nothing
2. 对匹配到的内容进行相关操作
-------------------------------------------------
Set re1 = New regExp
re1.Global = true
re1.IgnoreCase = true
re1.Multiline = true re1.Pattern = "\[textarea\]([?:\s\S]+)\[\/textarea\]"
Set Matches = re1.Execute(str)
for each match in Matches
match=replace(match,"<br/>",chr(13))
match=replace(match," ",chr(32))
match=replace(match,"<","<")
match=replace(match,">",">")
match=replace(match,"'","'")
match=replace(match,""",chr(34))
match=replace(match,"[textarea]","<textarea name=""textarea"" cols=""60"" rows=""10"">",1,-1,1)
match=replace(match,"[/textarea]","</textarea><br/><input type=""button"" onclick=""rc()"" value=""running code"" />",1,-1,1)
re1.Pattern = "\[textarea\][\s\S]+\[\/textarea\]"
str = re1.Replace(str,match)
next
set re1=nothing
-------------------------------------------------是不是单行模式不能捕获<br>这些的 如上面的例子
解决方案 »
- window.showModalDialog提交表单后自动关闭问题
- 请问下下面这段JavaScript代码,怎么放上自己的图片啊
- JS 判断与服务器是否相连
- var funcName = new Function(arguments, statements;); 中arguments是指什么呢?
- 关于获取值为空时退出函数的问题
- 求一个部分全选复选框的脚本
- 如何将一个string转化成Date?
- 图层显示问题?如何最上层显示?
- dwz框架里如何整合其他Jquery插件
- 围观了!!Javascript代码调试,Google中只能输出第一个,怎么回事?
- 求类似于csdn论坛一样的ubb代码
- javascript问题:
var s1="dasdasdasd \n sdadasdasdas" //有换行 单行模式无法匹配下面这个字符串