<!--
copywrite by alai http://www.9499.net All rights reserve
-->
<
HTML
><
HEAD
>
<
title
>
Power Maintenance Tools -- By Alai [http://www.9499.net]
</
title
>
<
META
HTTP-EQUIV
="Content-Type"
CONTENT
="text/html;charset=gb_2312-80"
>
</
HEAD
>
<
body
>
<
div
style
="FONT-WEIGHT:bold;FONT-SIZE:11pt;WIDTH:700px;TEXT-ALIGN:center"
>
高级查找/替换、正则表达式练习器、Javascript脚本程序调试器
<
br
>
<
textarea
id
='text1'
rows
='8'
cols
='82'
></
textarea
><
br
>
<
span
id
="spanFirst"
>
查询表达式
</
span
>
:
<
input
id
="txtFirst"
type
="text"
size
="60"
><
br
>
<
span
id
="spanSecond"
>
替换为
</
span
>
:
<
input
id
="txtSecond"
type
="text"
size
="56"
><
br
>
<
input
type
="button"
id
="btnExe"
value
="运行脚本程序"
>
<
input
type
="button"
id
="btnSchRpl"
value
="执行查找/替换"
>
<
input
type
="button"
id
="btnUndo"
value
="撤消"
disabled
="true"
>
<
input
type
="button"
id
="btnRedo"
value
="重做"
disabled
="true"
>
<
br
></
div
>
<
script
>
var aryUndo=[],aryRedo=[]function btnExe.onclick(){ if(text1.value=="")return false aryCommand=text1.value.split("\r\n") var linetry{ for(line=0;line<=aryCommand.length-1;line++) { eval(aryCommand[line]+";") }}catch(e){ var msg="执行脚本程序程序出错,在第"+(line+1)+"行。\n" msg+="错误代码:"+e.number+"\n" msg+="错误信息:"+e.description+"\n" alert(msg)}}function btnSchRpl.onclick(){ if(txtFirst.value=="") { alert("请输入查询条件!") txtSecond.focus() return false } aryUndo[aryUndo.length]=text1.value aryRedo=[] btnRedo.disabled=true btnUndo.disabled=false var s=new RegExp(txtFirst.value,"ig") text1.value=text1.value.replace(s,txtSecond.value)}function btnUndo.onclick(){ aryRedo[aryRedo.length]=text1.value btnRedo.disabled=false text1.value =aryUndo[aryUndo.length-1] aryUndo.length-- if(aryUndo.length==0)btnUndo.disabled=true}function btnRedo.onclick(){ aryUndo[aryUndo.length]=text1.value btnUndo.disabled=false text1.value=aryRedo[aryRedo.length-1] aryRedo.length-- if(aryRedo.length==0)btnRedo.disabled=true}
</
script
>
<
br
>
<
div
style
="width:100%;text-align:center;"
>
power by Alai
<
a
href
="http://www.9499.net"
>
http://www.9499.net
</
a
></
div
>
</
body
>
</
HTML
>
转载于:https://www.cnblogs.com/Elong/archive/2005/05/25/162186.html
相关资源:<<精通正则表达式>>书中源码
转载请注明原文地址: https://mac.8miu.com/read-79740.html