Changeset 2585
- Timestamp:
- 04/28/08 11:43:32 (2 months ago)
- Files:
-
- trunk/system/libraries/Validation.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/system/libraries/Validation.php
r2497 r2585 626 626 } 627 627 628 /** 629 * Rule: regex. Generates an error if the field does not match a specific regular 630 * expression. 631 * 632 * @param string field value 633 * @param array regular expression 634 * @return bool 635 */ 636 public function regex($value, array $patterns) 637 { 638 $patterns = preg_quote(implode(',', $patterns), '!'); 639 640 if (preg_match('![^'.$patterns.']+!', $value)) 641 { 642 return FALSE; 643 } 644 645 return TRUE; 646 } 647 628 648 } // End Validation
