本帖最后由 apang 于 2014-10-23 19:29 编辑
回复 4# wxdboiled
保存为Test.js,试下- fso = new ActiveXObject("Scripting.FileSystemObject");
- a = fso.OpenTextFile("filea.txt").ReadAll();
- b = fso.OpenTextFile("fileb.txt").ReadAll();
- a = a.replace(/( target=")(.*?)(" +URL=".*?([^/]+)\.html")/ig,
- function(s0, s1, s2, s3, s4) {
- re = new RegExp(s1 + s2 + '"', "ig");
- b = b.replace(re, s1 + s4 + '"');
- return s1 + s4 + s3
- }
- )
-
- fso.OpenTextFile("New_filea.txt", 2, true).Write(a)
- fso.OpenTextFile("New_fileb.txt", 2, true).Write(b)
复制代码
|