I am splitting a string into words for any uppercase letter and I am using the following regex:
'ThisIsTheStringToSplit'.match(/[A-Z][a-z]+/g);
Javascript Split string on UpperCase Characters
However if there are two or more upper case letters in a row I only want to split from the first letter.
'THISIsTheStringToSplit'
would split into the words THISIs
, The
, String
, To
, Split
.
How can I use regex to handle this case?