Small note to add a utility grep() function to our search class. Because almost every time we prepare a regex it is to grep data into it so we end up with code such as:
$filtered_strings = preg_grep($search->getRegex(), $source_strings);
And this would be shorter and more readable IMO:
$filtered_strings = $search->grep($source_strings);
Small note to add a utility grep() function to our search class. Because almost every time we prepare a regex it is to grep data into it so we end up with code such as:
And this would be shorter and more readable IMO: