Using Excel VBA
I'm not sure if you can do this with regex but what i'm trying to do is for a sting like
"ThisIsAn ExampleString"
Find each instance of a lowercase letter followed immediately by an uppercase letter, and then insert a pipe into it.
So the final result would be like
"This|Is|An Example|String"
So I'm guessing the pattern is "[a-z][A-Z]"
I'm starting to think i'm barking up the wrong tree with regex and should just try some sort of function.
Edit:
Thanks to all who gave answers below, you have given me the solution.
For anyone else reading this, this is what I ended up with:
Sub PipeInsert()
Dim cell As Range
For Each cell In Selection
cell.Value = ReplaceTest(cell.Value, "([a-z])([A-Z])", "$1|$2")
Next
End Sub
Function ReplaceTest(str1, patrn, replStr)
Dim regEx
' Create regular expression.
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.Global = True
' Make replacement.
ReplaceTest = regEx.Replace(str1, replStr)
End Function