I have a working regex code, but it's not including the non-letter characters. How would I include those?
$text = "i have one treehouse. i'm the one. I have two cats.";
preg_match_all('/[\w\s]+?\bone\s?[\w\s]*?\./', $text, $array);
print_r($array);
Expected Results
$array[0] = "i have one treehouse.";
$array[1] = "i'm the one";
Actual Results
$array[0] = "i have one treehouse.";
$array[1] = "m the one"; <---cuts off at the single quote
I think it's because the regex code doesn't look for non-letter characters like ',!? and so on. How do I include those?