From f65e481ebfac7d22bcf5f144c8f3009d177c41d7 Mon Sep 17 00:00:00 2001 From: predominant Date: Fri, 23 Apr 2010 17:04:25 +1000 Subject: [PATCH] Consoloidate duplicate regex strings in money() validation. --- cake/libs/validation.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cake/libs/validation.php b/cake/libs/validation.php index e1389ad0e..67a8f3f2b 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -472,10 +472,11 @@ class Validation { * @return boolean Success */ public static function money($check, $symbolPosition = 'left') { + $money = '(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?'; if ($symbolPosition == 'right') { - $regex = '/^(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?(?