| 273 | | $args = preg_split('/(?<!\\\\),\s*/', $matches[2]); |
| 274 | | |
| 275 | | // Replace escaped comma with comma |
| 276 | | $args = str_replace('\,', ',', $args); |
| | 273 | $args = $matches[2]; |
| | 274 | |
| | 275 | // Split the args, but don't touch them in case of a chars regex check |
| | 276 | if ($rule !== 'chars') |
| | 277 | { |
| | 278 | $args = preg_split('/(?<!\\\\),\s*/', $args); |
| | 279 | $args = str_replace('\\,', ',', $args); |
| | 280 | } |
| 768 | | public function chars($value, array $chars) |
| 769 | | { |
| 770 | | return ! preg_match('![^'.implode('', $chars).']!', $value); |
| | 772 | public function chars($value, $chars) |
| | 773 | { |
| | 774 | // Escape the preg_match delimeter |
| | 775 | $chars = str_replace('~', '\\~', $chars); |
| | 776 | |
| | 777 | // Prevent chars to escape the closing bracket of the character class |
| | 778 | $chars = rtrim($chars, '\\'); |
| | 779 | |
| | 780 | // Return FALSE if any char outside of chars list is found |
| | 781 | return ! preg_match('~[^'.$chars.']~u', $value); |