现在的位置: 网页制作教程网站制作经验 >正文
asp学习教程

asp检查文本文件是否包含特定文本

发表于2017/1/13 网站制作经验 0条评论 ⁄ 热度 1,639℃

asp如何检测文本文件是否包含指定的文本内容,我们编写一个检查的函数,如下:

Function isStringInFile(fileFullPath, PatternString)
Set objFSO = CreateObject("Scripting.FileSystemObject")
set re = New RegExp
strContents = readAllFromFile(objFSO,fileFullPath)
re.IgnoreCase = True
re.Pattern = PatternString
isStringInFile = re.test(strContents)
set objFSO = Nothing
End Function

fileFullPath代表文本路径。

PatternString代表特定的文本。

  • 暂无评论