Money validation accepts one decimal place

This commit is contained in:
spiliot 2013-04-19 01:58:08 +03:00
parent d01d291d13
commit 50e3307f00

View file

@ -528,7 +528,7 @@ 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})?';
$money = '(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{1})?';
if ($symbolPosition === 'right') {
$regex = '/^' . $money . '(?<!\x{00a2})\p{Sc}?$/u';
} else {