|
|
发表于 2008-10-14 15:48:26
|
显示全部楼层
来个vbs吧
因为论坛原因,用花括号代替了方括号,复制代码后自己改回- Set fso = CreateObject("Scripting.FileSystemObject")
- Set objFile = fso.OpenTextFile("a.txt")
- Do While objFile.AtEndOfStream <> True
- s = s & RegExpReplace(objFile.ReadLine) & vbCrLf
- Loop
- objFile.Close
- fso.OpenTextFile("a-new.txt",2,true).Write s
- Function RegExpReplace(strng)
- Set regEx = New RegExp
- regEx.Pattern = "[0-9]{6,9}" '匹配长度为6到9位之间的数字字串,因为QQ号码只有6~9位
- Set Matches = regEx.Execute(strng)
- For Each Match in Matches
- RetStr = Match.Value
- Next
- RetStr = regEx.replace(strng," {url=http://" & RetStr & ".com}" & RetStr & "{/url}")
- RegExpReplace = RetStr
- End Function
复制代码
[ 本帖最后由 zqz0012005 于 2008-10-14 15:51 编辑 ] |
|