Fix regex problem with PHP 5.5

Add unit test and fix the problem