"vba regex wildcard" Code Answer's
You're definitely familiar with the best coding language VBA that developers use to develop their projects and they get all their queries like "vba regex wildcard" answered properly. Developers are finding an appropriate answer about vba regex wildcard related to the VBA coding language. By visiting this online portal developers get answers concerning VBA codes question like vba regex wildcard. Enter your desired code related query in the search bar and get every piece of information about VBA code related question on vba regex wildcard.
vba regex wildcard

' Returns true if pSearched matches pPattern with wildcards
' Needs reference "Microsoft VBScript Regular Expressions 5.5"
Function RegexMatch(ByVal pSearched As String, ByVal pPattern As String, _
Optional ByVal pIgnoreCase As Boolean = True) As Boolean
Dim rRegex As Object
Set rRegex = CreateObject("VBScript.RegExp")
pPattern = Replace(pPattern, ".", "[.]")
pPattern = Replace(pPattern, "*", ".*")
pPattern = Replace(pPattern, "?", ".")
With rRegex
.IgnoreCase = pIgnoreCase
.Pattern = pPattern
End With
RegexMatch = rRegex.test(pSearched)
End Function
' ------------------------------------------------------------------------
Sub TestMe()
Debug.Print RegexMatch("helloworld.txt", "*.txt") 'True
Debug.Print RegexMatch("helloworld.txt", "hell*o?ld.tx*") 'True
Debug.Print RegexMatch("HELLOworld.txt", "hel*.tx*", False) 'False
End Sub
All those coders who are working on the VBA based application and are stuck on vba regex wildcard can get a collection of related answers to their query. Programmers need to enter their query on vba regex wildcard related to VBA code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about vba regex wildcard for the programmers working on VBA code while coding their module. Coders are also allowed to rectify already present answers of vba regex wildcard while working on the VBA language code. Developers can add up suggestions if they deem fit any other answer relating to "vba regex wildcard". Visit this developer's friendly online web community, CodeProZone, and get your queries like vba regex wildcard resolved professionally and stay updated to the latest VBA updates.