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>这些的 如上面的例子
解决方案 »
- 如何用Java script翻转器的方法实现一个纸牌游戏??
- 请教一下按照时间 显示随机数。
- 谁帮我解答一下,怎么获取<a>所在td的行和列
- onbeforeunload触发后不执行location.href?
- javascript拖拽问题
- 服务端代码调用js问题,高手help!
- url传递参数问题(在线等!)
- 下拉框问题
- 急急急,</font><font id="singInFont" color="#FF0000" onClick="changeAttribute(<%=charCLHJ%>)" style="cursor:hand" >怎么清除属性
- javascript 中有没有这样的函数……
- 求类似于csdn论坛一样的ubb代码
- javascript问题:
var s1="dasdasdasd \n sdadasdasdas" //有换行 单行模式无法匹配下面这个字符串