- Set regex=New RegExp
-
- regex.Global=True
-
- regex.Pattern="\=\s*(\d)"
-
- For Each i In regex.Execute(text)
-
- wsh.echo i.Submatches(0)
-
- Next
复制代码
- s=Split(text,"=")
-
- For i=1 To UBound(s)
-
- If IsNumeric(Left(LTrim(s(i)),1))then
-
- wsh.echo Left(LTrim(s(i)),1)
- else wsh.echo "no"
- End If
-
- Next
复制代码
- set fso = createobject("scripting.filesystemobject")
- ' 读取文件
- set stream = fso.opentextfile("a.txt",1)
- content = stream.readall()
- call stream.close()
- ' 替换字符串
- content = replace(content,"=","=^")
- content = replace(content,"*","♀")
- ' 保存文件
- set stream = fso.opentextfile("a.txt",2)
- call stream.write(content)
- call stream.close()
复制代码
|