找回密码
 加入
搜索
查看: 3988|回复: 5

[AU3基础] 请教:在我本地的一个 html 的源码指定地方插入一文本

    [复制链接]
发表于 2018-1-2 20:31:20 | 显示全部楼层 |阅读模式
悬赏5金钱已解决
本帖最后由 jack29483527 于 2018-1-4 17:13 编辑

本地有一个网页文件是 : 1.html,其网页源码如下:

<html>
<body>
  <table width="100%" border="1">
    <tr>
      <td><!-- InstanceBeginEditable name="201701" -->  <!-- InstanceEndEditable --></td>
    </tr>
  </table>
</body>
</html>

我想实现在标签:<!-- InstanceBeginEditable name="201701" -->     后面插入   “this is a test"   文本,请教要怎样才能实现此类操作。
发表于 2018-1-2 20:31:21 | 显示全部楼层
$sFile = @ScriptDir & '\1.html'
$open = FileOpen($sFile,FileGetEncoding($sFile))
$sRead = FileRead($open)
FileClose($open)
$sRead = StringRegExpReplace($sRead,'(?im)(InstanceBeginEditable.+?>)(\s*)(<)','${1}This is a test${3}')
$open = FileOpen($sFile,FileGetEncoding($sFile)+2)
FileWrite($open,$sRead)
FileClose($open)
发表于 2018-1-3 14:28:21 | 显示全部楼层
回复 2# zghwelcome


    赞一个  
 楼主| 发表于 2018-1-3 15:32:46 | 显示全部楼层
回复 2# zghwelcome


    你太厉害,学得如此深入。
发表于 2018-1-8 19:52:10 | 显示全部楼层
后面的${1}和${3}是什么意思  没看懂
发表于 2018-1-8 19:52:12 | 显示全部楼层
后面的${1}和${3}是什么意思  没看懂
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-28 14:35 , Processed in 0.071449 second(s), 18 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表