18 Nov 2013

Count the number of specific characters in a string using Regular Expression

Count the number of specific characters in a string using Regular Expression

Dim reRegExp 
str="BARBARICB"
 Set reRegExp = New RegExp
 With reRegExp
     .Global = True
     .Pattern = "B"
 Set Regcount = .Execute(str)
 End With
msgbox Regcount.count

No comments:

Post a Comment