function getCategories($params) { // expression to search for $regex = "#{cat\\s*(.*?)}(.*?){/cat}#s"; // parse categories preg_match_all($regex, $params, $matches); $count = count($matches[0]); if ($count) { return YOOsearchHelper::parseCategories($matches, $count); } }