To be used for archiving purposes only. No new posts will be made. View Scope's Farewell Message
Public Function WildCard_Match(ByRef theName As String, ByRef theWildcard As String) As Boolean 'AStar = "*" 'both theName and theWildcard should be lowercase for these checks, so you 'can do that here, or before the routine if you know theres going theres going to be wildcards. If AscW(theWildcard) = 42 And AscW(Right$(theWildcard, 1)) = 42 Then 'if *wildcard* If InStrB(Mid$(theWildcard, 2, (Len(theWildcard) - 2)), AStar) Then 'if using complex wildcards use like WildCard_Match = theName Like theWildcard Else 'typical wildcards WildCard_Match = InStrB(theName, Mid$(theWildcard, 2, (Len(theWildcard) - 2))) End If ' ElseIf AscW(theWildcard) = 42 And AscW(Right$(theWildcard, 1)) <> 42 Then 'if *wildcard If InStrB(Mid$(theWildcard, 2), AStar) Then 'complex wildcards WildCard_Match = theName Like theWildcard Else 'typical wild cards If Right$(theName, (Len(theWildcard) - 1)) = Mid$(theWildcard, 2) Then WildCard_Match = True End If ' ElseIf AscW(theWildcard) <> 42 And AscW(Right$(theWildcard, 1)) = 42 Then 'if wildcard* If InStrB(Left$(theWildcard, Len(theWildcard) - 1), AStar) Then 'complex wildcards WildCard_Match = theName Like theWildcard Else 'typical wildcards If Left$(theName, (Len(theWildcard) - 1)) = Left$(theWildcard, (Len(theWildcard) - 1)) Then WildCard_Match = True End If ' Else 'if wild*card WildCard_Match = theName Like theWildcard ' End If End Function'checks if the name contains the wildcard
eX.Pro, shut the fuck up, I'm removing your posts for a reason.
Good Work, ben.i never heard of "Like" function.Good Link:Like Operator (Visual Basic)http://msdn.microsoft.com/en-us/library/swf8kaxw.aspxwhy not the simply right / left to detect the "*" and use instrB ? since the "like" function is slow..
\d*.\d*.\d*.\d*.\d*:\d
r+
^p*
o*$
Code: [Select]\d*.\d*.\d*.\d*.\d*:\dThis would match a proxy.
Code: [Select]r+would be like doing a *r*
Code: [Select]^p*this equal p*
Wouldn't it be easier to just use regex?