I'm trying to trim a string and remove any vowel and white space and duplicate characters.
Here's the code I'm using
Function TrimString(strString As String) As String
Dim objRegex As Object
Set objRegex = CreateObject("vbscript.regexp")
With objRegex
.Global = True
.IgnoreCase = True
.Pattern = "[aeiou\s]"
TrimString = .Replace(strString, vbNullString)
.Pattern = "(.)\1+"
TrimString = .Replace(TrimString, "$1")
End With
End Function
Is there a way to combine both patterns instead of doing this in 2 steps?
Thank you in advance.