Here is the code to do a Regex search using OR for keywords
How do you write a RegEx or AND all the keywords? That mean all the keywords must be in the $someStringToSearch...PHP Code:$keyword = explode(' ', $_REQUEST['searchInput']);
$regex = "/".implode('|', $keyword)."/i";
if (preg_match($regex, $someStringToSearch)) {
$result .= "$value.<br>";
}
Thanks alot




Bookmarks