I have some strings which can be in the following format:
sometext moretext 01 text text sometext moretext 002 text text 1 (somemoretext) etc
I want to split these strings into following:
- text before the number and
- the number
For example:
text text 1 (somemoretext)
When split will output:
text = text text
number = 1
Anything after the number can be discarded.
Alternatively, you can use
preg_match_allwith capture groups to do it all in one shot: