This question is a continuation of my previous question:
I want split paragraph string into array of sentences using regular expression with character dot (.). And the next problem is about number.
Here is an example :
In this year 2013. Hello Mr. Andre, your money is Rp 40.000.
Of course the correct output :
Array ( [0] => In this year 2013 [1] => Hello Mr. Andre, your money is Rp 40.000 )
The title problem (Mr.) is already solved from my question before. I've tried with adding regex of number but still don't work.
My not worked code :
$titles_number=array('(^[0-9]*)','(?<!Mr)', '(?<!Mrs)', '(?<!Ms)');
$sentences=preg_split('/('.implode('',$titles_number).')\./',$text);
print_r($sentences);
Can I do this with one blow (one regex to get rid two problem)? Tell me if I can't do it. Thanks in advance
(?<!\d)(?!\d)for negative lookahead and look behind for digits?