正则表达式调试器代码

None.gif <!--  copywrite by alai http://www.9499.net All rights reserve -->
None.gif
< HTML >< HEAD >
None.gif        
< title > Power Maintenance Tools -- By Alai [http://www.9499.net] </ title >  
None.gif        
< META  HTTP-EQUIV ="Content-Type"  CONTENT ="text/html;charset=gb_2312-80" >
None.gif    
</ HEAD >
None.gif    
< body >
None.gif        
< div  style ="FONT-WEIGHT:bold;FONT-SIZE:11pt;WIDTH:700px;TEXT-ALIGN:center" >
None.gif            高级查找/替换、正则表达式练习器、Javascript脚本程序调试器
< br >
None.gif            
< textarea  id ='text1'  rows ='8'  cols ='82' ></ textarea >< br >
None.gif            
< span  id ="spanFirst" > 查询表达式 </ span > < input  id ="txtFirst"  type ="text"  size ="60" >< br >
None.gif            
< span  id ="spanSecond" > 替换为 </ span > < input  id ="txtSecond"  type ="text"  size ="56" >< br >
None.gif            
< input  type ="button"  id ="btnExe"  value ="运行脚本程序" >
None.gif            
< input  type ="button"  id ="btnSchRpl"  value ="执行查找/替换" >
None.gif            
< input  type ="button"  id ="btnUndo"  value ="撤消"  disabled ="true" >
None.gif            
< input  type ="button"  id ="btnRedo"  value ="重做"  disabled ="true" >
None.gif            
< br ></ div >
ExpandedBlockStart.gifContractedBlock.gif        
< script > dot.gif
InBlock.gif
var aryUndo=[],aryRedo=[]
InBlock.gif
function btnExe.onclick()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif    
if(text1.value=="")return false
InBlock.gif    aryCommand
=text1.value.split("\r\n")
InBlock.gif    
var line
ExpandedSubBlockStart.gifContractedSubBlock.gif
trydot.gif{
InBlock.gif    
for(line=0;line<=aryCommand.length-1;line++)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif            eval(aryCommand[line]
+";")    
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif}

ExpandedSubBlockStart.gifContractedSubBlock.gif
catch(e)dot.gif{
InBlock.gif        
var msg="执行脚本程序程序出错,在第"+(line+1)+"行。\n"
InBlock.gif        msg
+="错误代码:"+e.number+"\n"
InBlock.gif        msg
+="错误信息:"+e.description+"\n"
InBlock.gif        alert(msg)
ExpandedSubBlockEnd.gif}

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
function btnSchRpl.onclick()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif    
if(txtFirst.value=="")
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif       alert(
"请输入查询条件!")
InBlock.gif       txtSecond.focus()
InBlock.gif       
return false
ExpandedSubBlockEnd.gif    }

InBlock.gif     aryUndo[aryUndo.length]
=text1.value
InBlock.gif     aryRedo
=[]
InBlock.gif     btnRedo.disabled
=true 
InBlock.gif     btnUndo.disabled
=false 
InBlock.gif
InBlock.gif        
var s=new RegExp(txtFirst.value,"ig")
InBlock.gif     text1.value
=text1.value.replace(s,txtSecond.value)
ExpandedSubBlockEnd.gif}

InBlock.gif
function btnUndo.onclick()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif    aryRedo[aryRedo.length]
=text1.value
InBlock.gif    btnRedo.disabled
=false
InBlock.gif    text1.value 
=aryUndo[aryUndo.length-1]
InBlock.gif    aryUndo.length
--
InBlock.gif    
if(aryUndo.length==0)btnUndo.disabled=true
ExpandedSubBlockEnd.gif}

InBlock.gif
function btnRedo.onclick()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif    aryUndo[aryUndo.length]
=text1.value
InBlock.gif    btnUndo.disabled
=false
InBlock.gif    text1.value
=aryRedo[aryRedo.length-1]
InBlock.gif    aryRedo.length
--
InBlock.gif    
if(aryRedo.length==0)btnRedo.disabled=true
ExpandedSubBlockEnd.gif}

ExpandedBlockEnd.gif        
</ script >
None.gif        
< br >
None.gif
< div  style ="width:100%;text-align:center;" > power by Alai  < href ="http://www.9499.net" > http://www.9499.net </ a ></ div >
None.gif    
</ body >
None.gif
</ HTML >
None.gif
None.gif

转载于:https://www.cnblogs.com/Elong/archive/2005/05/25/162186.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值