vendredi 6 décembre 2019

Laravel Regex Validations

I have price validations, price can enter commas and decimals as well, I searched so many regex patterns and I am way near to this but still failed:

^[0-9]{1,3}(,[0-9]{3})*\.[0-9]+$

I want that user may enter "12" or "12.00" or "12,000" that should be allowed, I also made this:

'price'        => ['required', 'regex:/^[0-9]{1,3}(,[0-9]{3})*\.[0-9]+$/'],


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire