hello need help in regex i use this to split strings with capital letters like OldMcDonald
preg_split('/(?=[A-Z])/', $data, -1, PREG_SPLIT_NO_EMPTY);
output
[0] => Old
[1] => Mc
[2] => Donald
now i need to split strings like MWTTH
i need to tell the regex that a T with a letter H is one word how can i apply in my regex?
need the output:
[0] => M
[1] => w
[2] => T
[3] => TH
when i tried
$array = preg_split('/(?=[A-Z][TH])/', $data, -1, PREG_SPLIT_NO_EMPTY);
Output is
Array
(
[0] => MTW
[1] => F
[2] => TH
)
MTH Does not break appart, No time to study regex now.
I should have studied a little further i could have got it, anyway i already found it out i used:
OUTPUT
while this will only work for predefined data like mine.