preg_match to allow all symbols from keyboards
In codeigniter, they have this function
function _clean_input_keys($str)
{
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
{
exit('Disallowed Key Characters.');
}
return $str;
}
preg_match rul开发者_开发知识库es only accepts alpha numeric text and few other items. But I want to accept all the characters from keyboards such as !@#%^&*()-+?/":[]|~` . How can i change the above preg_match rules to accept all these. Please kindly help me with it. Thank you
Look into the PHP Filter functions. Specifically http://www.php.net/manual/en/filter.filters.sanitize.php FILTER_FLAG_STRIP_LOW, FILTER_FLAG_STRIP_HIGH
精彩评论