I have string set like the following example;
"Some string without integer 12345a1% rest of the string with/without integer"
After extracting 12345a1% from the actual string I want to split extracted string by two part; the first part is the number part, and the second part is the first character and rest of the numbers. But the second part should only be split if the starting character is specific (a,d,m,n,o).
Example;
// First
"Some string 12345a1% some other string."
// Second
"Somet string 23456b2! some other string
Desired output;
// First
0 => 12345
1 => "a1"
// Second
0 => 23456
1 => null
What I tried is the following but I get incorrect result.
$split = preg_split('/\$([0-9]*)(a|d|m|n|o\s)(\d*)/', $input, -1, PREG_SPLIT_NO_EMPTY);
Is there any point am I missing? Thanks in advance.