I'm trying to replace all the text in a string between the pattern "&CC[number]:[number]" and replace it with a "==".
Here is the string. "T &CC3:5 Q8 Party/ Self-Identify&CC6:8 Male&CC9:11 Female&CC12:15 Q1 Vote"
This is what I need it to look like T &CC3:5==&CC6:8==&CC9:11==&CC12:15==
I know I need to loop through this string but I'm not sure the best way to set this up.
Dim stringOne As String
Dim regexOne As Object
Set regexOne = New RegExp
regexOne.Pattern = "([Q])+[0-9]"
regexOne.Global = False
stringOne = "T &CC3:5 Q8 Party/ Self-Identify&CC6:8 Male&CC9:11 Female&CC12:15 Q1 Vote"
Debug.Print regexOne.Replace(stringOne, "==")
End Sub
I have also explored using this regular expression regexOne.Pattern = "([&])+[C]+[C]+[0-9]+[:]+[0-9]"
I plan to eventually set the variable stringOne to Range("A1").Text