is wrong (\S is the opposite of \s, there ar more than 1 space between the numbers, the second part is longer than 1 char), so it matches your data just by accident.
Try this:
Dim objRegEx : Set objRegEx = CreateObject("VBScript.RegExp") objRegEx.Global = True objRegEx.Pattern = "[0-9]{1,}\S[0-9a-zA-Z]" objRegEx.Pattern = "([0-9]{1,})\s+([0-9a-zA-Z]+)" objRegEx.IgnoreCase = True Dim strSearchString : strSearchString = "3740 16F8"
Dim colMatches : Set colMatches = objRegEx.Execute(strSearchString) If colMatches.Count > 0 Then Dim strMatch For Each strMatch in colMatches Wscript.Echo "|" & strMatch.Value & "|" Wscript.Echo "|" & strMatch.SubMatches( 0 ) & "|" Wscript.Echo "|" & strMatch.SubMatches( 1 ) & "|" Next End If
Posts: 448
Score: 0
Joined: 1/11/2005
From: USA
Status: offline
If my search string is
Will the same code apply to get the pid and the '3D0555'? It works, but I am just trying to make sure it is reliable. Right now I have my code splitting on ":", but if I can take that extra step out that would be nice.