I was trying to include the delimiter while using preg_split but was unsuccessful.
print_r(preg_split('/((?:fy)[.]+)/', 'fy13 eps fy14 rev', -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY));
I'm trying to return:
array(
[0] => fy13 eps
[1] => fy14 rev
)
With the flags parameter set to PREG_SPLIT_DELIM_CAPTURE:
If this flag is set, parenthesized expression in the delimiter pattern will be captured and returned as well.
The fy is in parenthesis, so I don't know why this doesn't work.