学习正则帮手笨狼正则练习器

2023-12-08 0 500

<HTML> <HEAD> <TITLE>笨狼正则练习器_www.jb51.net悠久资源网</TITLE> <style> body { font-size:12; BACKGROUND:#DADADA; margin-left:20; } #blockORG { font-family:Verdana; font-size:12px; overflow:scroll; height:300; } #fileORG { width:400; } #blockReg { font-family:Verdana; font-size:12px; } #showMe { font-family:Verdana; font-size:12px; height:200; overflow:visible; } #replaceVar { font-family:Verdana; font-size:12px; top:341; } #isScriptDIV { position:absolute; top:361; overflow-x:visible; } </style> </HEAD> <BODY> <INPUTtype=\”file\”id=\”fileORG\”onchange=\”vbs:showORG\”/> <buttononclick=\”vbs:showORG\”>载入</button> <inputtype=\”checkbox\”id=\”Imode\”checked/>忽略大小写 <inputtype=\”checkbox\”id=\”Gmode\”checked/>全局&nbsp; <buttononclick=\”vbs:back\”>清空</button> <buttononclick=\”vbs:saveFile\”>保存</button><br/> <textAreaid=\”blockORG\”></textArea><br/> 表达式:<inputid=\”blockReg\”/><br/> 替换为:<inputid=\”replaceVar\”/><inputtype=\”hidden\”id=\”jsvalue\”/> <divid=\”isScriptDIV\”> <buttonid=\”normal\”onclick=\”vbs:gogogo\”>普通替换</button> <buttonid=\”isVBS\”onclick=\”vbs:gogogo\”>vbs表达式替换</button> <buttonid=\”isJS\”onclick=\”vbs:gogogo\”>js表达式替换</button> </div> <textAreaid=\”showMe\”></textArea> <SCRIPTLANGUAGE=\”vbScript\”> \’设置窗体尺寸 window.resizeTowindow.screen.availWidth,window.screen.availHeight window.moveTo0,0 blockORG.style.width=cint(window.screen.availWidth*0.94) blockReg.style.width=px2Int(blockORG.style.width)-100 replaceVar.style.width=px2Int(blockReg.style.width)-400 isScriptDIV.style.left=px2Int(replaceVar.style.width)+100 showMe.style.width=blockORG.style.width dimfso,Re setRe=newRegExp setfso=createObject(\”Scripting.FileSystemObject\”) dimreplaceStr dimthisFileDir\’定义本文件绝对路径 dimthisFileName\’定义本文件名 dimthisFileFolder\’定义本文件夹路径 thisFileDir=replace(window.location.href,\”file:///\”,\”\”) thisFileDir=unescape(replace(thisFileDir,\”/\”,\”\\\”)) thisFileName=LastOne(thisFileDir,\”\\\”) thisFileFolder=getFolderDir(thisFileDir) subshowORG() \’在文本框内加载文件 dimf,ts,s iffso.FileExists(fileORG.value)then setf=fso.GetFile(fileORG.value) setts=f.OpenAsTextStream(1) s=\”\” ifnotts.AtEndOfStreamthen s=ts.ReadAll endif ts.Close blockORG.value=s endif endsub FunctionLastOne(Str,splitStr) \’输入字符和分隔符,得到最后一部分 LastOne=right(Str,len(Str)-InStrRev(Str,splitStr)) EndFunction functiongetFolderDir(fullDir) \’输入得到全路径,得到文件夹路径 s=LastOne(fullDir,\”\\\”) getFolderDir=left(fullDir,len(fullDir)-len(s)) endfunction functionpx2Int(px) px2Int=cint(replace(px,\”px\”,\”\”)) endfunction subgogogo() Re.IgnoreCase=Imode.checked Re.Global=Gmode.checked Re.Pattern=blockReg.value replaceStr=replaceVar.value selectcasewindow.event.srcElement.id case\”isVBS\” replaceStr=eval(replaceStr) case\”isJS\” window.execScript\”jsvalue.value=eval(replaceVar.value);\”,\”javaScript\” replaceStr=jsvalue.value endselect showMe.value=Re.Replace(blockORG.value,replaceStr) endsub subback showMe.value=\”\” endsub subsaveFile iffso.FileExists(fileORG.value)then setf=fso.GetFile(fileORG.value) f.copyfileORG.value&makeRand()&\”.bak\”\’创建备份 setts=f.OpenAsTextStream(2) ts.writeshowMe.value ts.Close blockORG.value=showMe.value else setts=fso.OpenTextFile(thisFileFolder&makeRand()&\”.txt\”,2,true) ts.writeshowMe.value ts.Close blockORG.value=showMe.value endif endsub functionmakeRand() dimresault resault=mid(cstr(now()),3) resault=replace(resault,\”:\”,\”\”) resault=replace(resault,\”-\”,\”\”) resault=replace(resault,\”\”,\”\”) makeRand=resault endfunction </SCRIPT> </BODY> </HTML> 笨狼正则练习器.hta

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 hta 学习正则帮手笨狼正则练习器 https://www.u-9.cn/jiaoben/hta/145317.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务