I have a problem regex matching an upper case letter possibly followed by a lower case letter. I want to break after any such matches, but I just can't seem to get it to work.
To make it more general - I want to split before and after any matches in regex.
Example string "TeSTString"
Wanted result -> [Te, S, T, St, ring]
I have tried anything I can think of, but I'm getting tricked by look-ahead or behind.
First I tried [A-Z][a-z]?, and that matches perfect, but removes it...
result -> [ring]
after this I did positive look-ahead (?=([A-Z][a-z]?)) giving me something close...
result -> [Te, S, T, String]
and look-behind (<=?([A-Z][a-z]?)) giving nothing at all...
result -> [TeSTString]
even tried reversing the look-behind (<=?([a-z]?[A-Z])), in a desperate attempt, but this was fairly unsuccessful.
Can anyone give a good pointer in the right direction before I lose my mind?
Stringbe split intoStandring?