I am looking to split a cell after the first instance of a word with multiple caps.
Example 1:
Input1: Floor 4 InformatiqueNoosavilleSep
Desired Output1: NoosavilleSep
Pattern: The split should occurs at the second instance of uppercase in the last word. "InformatiqueNoosavilleSep"
Example 2:
Input: Floor 13 InformatiqueSurfers ParadiseSep
Output: Surfers ParadiseSep
Pattern: The split shouldn't occurs at the last word but on "InformatiqueSurfers" instead.
The problem: The pattern to find where to split the word differs from a cell to another.
What we know:
1: If the last word contains three uppercase letter it's always at this word that we want to split the string.Example1
2: If the last word contains only two uppercase letter "ParadiseSep" we have to split the string on the the word before it. Example2
I found this code which allow to split string with caps lock and add a spaces.
Dim objRegex As Object
Set objRegex = CreateObject("vbscript.regexp")
With objRegex
.Global = True
.Pattern = "([a-z])([A-Z])"
SplitCaps = .Replace(strIn, "$1 $2")
End With
End Function
As I am trying to learn VBA this Regex is getting a bit out of my realm.
Thanks for reading!