The following expression seems pretty good:
$arr = preg_split('#(?<=[.?!](\s|"))\s?(?=[A-Z\b"])#',$str);
I tested it on
When my friend said he likes deep dish pizza one day, I
immediately set a time to come back to Little Star. Arguably, the best
deep dish pizza in SF...though...I don't believe there are many places
that do deep dish pizza. That being said...its not the BEST ever, just
the best "for the area." They use cornmeal in the crust, or on the
baking surface, so there's a bit of extra crunch to it. That being
said...I'm not sure how much I like the cornmeal texture to my pizza.
I kind of want just a GOOD CRUST, you know? No extra stuff to try to
make it more crunchy.
Outcome:
Array
(
[0] => When my friend said he likes deep dish pizza one day, I immediately set a time to come back to Little Star.
[1] => Arguably, the best deep dish pizza in SF...though...I don't believe there are many places that do deep dish pizza.
[2] => That being said...its not the BEST ever, just the best "for the area."
[3] => They use cornmeal in the crust, or on the baking surface, so there's a bit of extra crunch to it.
[4] => That being said...I'm not sure how much I like the cornmeal texture to my pizza.
[5] => I kind of want just a GOOD CRUST, you know?
[6] => No extra stuff to try to make it more crunchy.
)
However, it will fail when you do something like
I met Ms. Scarlet in the library.
As the . S
will be interpreted as your "definition of a new line".