I'm piping the output of a command box into a variable which I then turn into an array. I'm looping through the array and I'm trying to look for multiple words in the text.
Is this possible?
I want to search for each of the following:
Server:
Address:
Microsoft (R)
Copyright (C)
If my match count is greater than 0 then I want to ignore that line.
Here is what I have so far that works great for searching one of my criteria.
I'm coding in vbscript but have found in the past that RegEx is virtually the same in JavaScript.
I guess what I am trying to do is get something like this to work:
objRegExpr.Pattern = "Server:" OR "Address:"
But that syntax is bad. Does anyone know if this is possible or do I need to nest expressions?
I hope you find this post helpful.
Regards,
Mark
Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
Is this possible?
I want to search for each of the following:
Server:
Address:
Microsoft (R)
Copyright (C)
If my match count is greater than 0 then I want to ignore that line.
Here is what I have so far that works great for searching one of my criteria.
I'm coding in vbscript but have found in the past that RegEx is virtually the same in JavaScript.
Code:
nslookupinfo = Split(strNsLookupStdOut,vbCr)
'Declare our variable
Dim objRegExpr
'Create an instance of the regexp object
Set objRegExpr = New RegExp
objRegExpr.Pattern = "Address:"
objRegExpr.Global = True
objRegExpr.IgnoreCase = True
For Each line In nslookupinfo
Set colMatches = objRegExpr.Execute(line)
If colMatches.Count = 0 Then
If Len(line) > 2 Then
WScript.echo line
End If
End If
Next
I guess what I am trying to do is get something like this to work:
objRegExpr.Pattern = "Server:" OR "Address:"
But that syntax is bad. Does anyone know if this is possible or do I need to nest expressions?
I hope you find this post helpful.
Regards,
Mark
Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.