Board logo

标题: [问题求助] vbs脚本怎样自动匹配文件名? [打印本页]

作者: zxcvb888    时间: 2013-1-14 22:56     标题: vbs脚本怎样自动匹配文件名?

想要自动匹配文件名0123200300100010001=0123-2003-001-0001-0001,如何编写?
作者: batman    时间: 2013-1-15 00:09

  1. Dim FileName
  2. FileName = "0123200300100010001"
  3. WScript.Echo RegText(FileName)
  4. Function RegText(RegStr)
  5.   Dim RegEx
  6.   Set RegEx = New RegExp
  7.   RegEx.Pattern = "(\d{4})(\d{4})(\d{3})(\d{4})(\d{4})"
  8.   RegText = RegEx.Replace(RegStr, "$1-$2-$3-$4-$5")
  9.   Set RegEx = Nothing
  10. End Function
复制代码





欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2