Match text - case sensitive



Hello,

I'm trying to write a script that will match a particular string and it

must be lower case. After it creates a collection based off that
logic, it will loop through the collection with the entries that match.

Here is my attempt so far. I've seen some stuff on InStr but from
what I'm reading it seems that Regular Expressions is the better way to

go. A little help please, thanks.


Dim oUser, strLogFile, strUserDN, objUser, email
Dim colMatches
Dim objRegExpr


oUser = "LDAP://CN=test,CN=Users,DC=test,DC=com";
Set objUser = GetObject(oUser)
Set objRegExpr = New regexp


objRegExpr.Pattern = "smtp:"
objRegExpr.IgnoreCase = False


For Each email In objUser.GetEx("proxyAddresses")
email = Left(email,5)
WScript.Echo email
Set colMatches = objRegExpr.Execute(email)
Next
'objUser.SetInfo
For Each objMatch in colMatches
WScript.echo objMatch.Value
Next

.



Relevant Pages

  • Match text - Case Sensitive
    ... Dim oUser, strLogFile, strUserDN, objUser, email ... Dim objRegExpr ... Set objUser = GetObject ... Set colMatches = objRegExpr.Execute ...
    (microsoft.public.scripting.vbscript)
  • VB Script for RegEx file processing
    ... Dim objRegExpr ... Dim objMatch ... Set colMatches = objRegExpr.Execute ...
    (microsoft.public.scripting.vbscript)
  • Can Someone Please Help With This .ASP Page (Reset AD User Password)
    ... Dim strUserDN, objUser, strOu, strPort ... Dim strUsername, strDomain, strPassword ... Dim strAdmin, strAdmPasswd ... Set objUser = DSO.OpenDSObject(AdsPath, AlternateUser, strAdmPasswd, ...
    (microsoft.public.scripting.vbscript)
  • Re: Correct Syntax for group membership of two groups
    ... I do not see where you SET objUser. ... You Dim ... > membership for a condition to map the appropriate drives. ...
    (microsoft.public.scripting.wsh)
  • ReadAll and RegExp
    ... Dim objFSO ... Dim strTempName, strTempPath ... Dim strLine, strLineBack1, strLineBack2 ... Dim ss, re, rv, objMatch, ColMatches, StrReturnStr ...
    (microsoft.public.scripting.vbscript)