本帖最后由 pcl_test 于 2016-4-1 23:43 编辑
举个栗子- /*&cls
- @echo off
- more +21 "%~f0"|cscript -nologo -e:jscript "%~f0"
- pause&exit
- */
-
- var txt1 = 'a\r\n1'.split('\r\n'),
- txt2 = 'b\r\n2'.split('\r\n'),
- txt3 = 'c\r\n3'.split('\r\n'),
- txt4 = 'd\r\n4'.split('\r\n');
-
- var arr = txt1.concat(txt2, txt3, txt4);
-
- var txt = WScript.StdIn.ReadAll().replace(/([\s\S]+)\*\//,'$1');
- var retxt = txt.replace(
- /(<Matrix\stx=")([^"]*)("\sty=")([^"]*)("\s?\/>)/g,
- function($0,$1,$2,$3,$4,$5){return $1+arr.shift()+$3+arr.shift()+$5}
- )
- WSH.echo(retxt);
-
- /*
- ……
- <Matrix tx="fwef" ty="sdw"/>
- ……
- <Matrix tx="dsfd" ty="rge"/>
- ……
- <Matrix tx="4g4" ty="vvg"/>
- ……
- <Matrix tx="5h5f" ty="787"/>
- ……
- */
复制代码
|