Hello,
I am trying to use a regular expression in Visual Basic Script tomatch some filenames within a folder. However, I am having someissues with the negative range character. I cannot seem to finda way to return all results that do NOT include the "+"character and end with a specific extension. The issue seems tobe with the "[^\+].*" portion of the statement, but I am notsure how to just return palmpack.par2...
filename to match: file_name.par2
filename NOT to match: file_name.vol0_1.par2,file_name.vol100_55.par2, ....
Const Extension = "\.par$|.*[^\+].*\.par2$"
Function FindText(patrn, strng)
'Determine if the pattern exists in a string
Dim regEx ' Create variable.
Set regEx = New RegExp ' Create regular expression.
regEx.Pattern = patrn ' Set pattern.
regEx.IgnoreCase = True ' Set case sensitivity.
regEx.Global = True ' Set global applicability.
FindText = regEx.Test(strng) ' Execute the search test.
End Function
files in the directory:
--------------------
palmpack.par2
palmpack.vol0+1.PAR2
palmpack.vol03+1.PAR2
palmpack.vol04+2.PAR2
palmpack.vol17+04.PAR2
RETURNS:
---------
palmpack.par2
palmpack.vol17+04.PAR2
Any help would be appreciated!
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>OaiEVi3JIUu2y6kfaHUuQg==</Id>