Showing posts with label Count the number of specific characters in a string using Regular Expression. Show all posts
Showing posts with label Count the number of specific characters in a string using Regular Expression. Show all posts

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