===== Syntax ===== string preg_quote(string $str [, string $delimiter]) //(PHP 4, PHP 5)// ^ $str | The source string that you want to quote. | ^ $delimiter | An additional (non-standard) character which should be escaped. This is normally used to escape the character which delimits the start and end of the pattern (see example below). | ^ RETURNS | The quoted pattern string with special characters escaped (normally, this is done with a backslash character (\). | ===== What it Does ===== This function adds special escape codes to characters which have special meaning in a POSIX regular expression. Use this to prevent undesirable results from unknown or user-entered patterns which are used in pattern matching. ===== Example ===== // create the subpattern to match (escaping special chars) $subpattern = preg_quote($_POST['keyword'], "|"); // match a phone number $pattern = '|\b'.$subpattern.'\b|gi'; // attempt to match something $nomatches = preg_match_all($pattern, $searchtext, $out);