· 이제 아는 정규식을 총동원해서 규칙을 생성해주시면 됩니다! 말은 무지 간단하네요^^;
//C:\CodeIgniter_2.1.0\system\libraries\Form_validation.php
/** * Convert PHP tags to entities * * @access public * @param string * @return string */ public function encode_php_tags($str) { return str_replace(array('<?php', '<?PHP', '<?', '?>'), array('<?php', '<?PHP', '<?', '?>'), $str); } public function alpha_number_kr($str) { //특수문자, 한글, 영문, 숫자 return ( ! preg_match("/^([\+\.\:\-_ 가-힣a-zA-Z0-9])+$/i", $str)) ? FALSE : TRUE; } public function alpha_kr($str) { //한글, 영문 return ( ! preg_match("/^([가-힣a-zA-Z])+$/i", $str)) ? FALSE : TRUE; } public function id($str) { //맨 앞글자 반드시 영문, 그 뒤 영문, 숫자, 특수문자 return ( ! preg_match("/^([a-zA-Z]+[a-zA-Z0-9\-\_\.])+$/i", $str)) ? FALSE : TRUE; } public function zero($str) { //숫자 0 return ( $str == '0') ? FALSE : TRUE; } public function blank($str) { //빈칸 return ( isset($str)) ? FALSE : TRUE; } public function noCheck($str) { //not 'no' return ( $str != 'no') ? FALSE : TRUE; }
|