I'm using preg_split regex to split sentences into arrays. I am able to do this successfully. However, part of the pattern I'm telling preg_replace to find is part of the text itself. So part of the text is being removed as well. Is there a way to re-insert the pattern into the array? For instance, if I tell preg_spit to search for a period and a capital letter after that, it will remove the capital letter from the array, which I don't want.
This is the code:
$line = preg_split("@[\.\?\!\:][\W]+[A-Z]@"
Sample String:
This is sentence one. This is sentence two? This is sentence three! This is sentence four: This is sentence five. This is sentence six, this is also U.S. sentence six. Secretary of Defense Chuck Hagel echoed Kerry's remark, saying "very high" when asked by Virginia Democratic Rep. Gerry Connolly about the likelihood of another Syrian chemical attack absent U.S. action.
Is there a way around this?
Thanks