Saturday, February 24, 2018

Regular Expression is not working properly in laravel validation - development

Regular Expression is not working properly in laravel validation

I am using laravel validation. I want to take input and store data like this.
111-111-111. This is the demo value. There should be 3 number in each part.
Here is my validation rule

'id'  => 'required|regex:/[0-9]{3}-[0-9]{3}-[0-9]{3}/|unique:info',

First two part working perfect but in last part I can take more than 3 number. I mean if input is 111-111-11111 it take the input.



from Laravel Questions and Answers https://laravelquestions.com/laravel/regular-expression-is-not-working-properly-in-laravel-validation/
via Lzo Media

No comments:

Post a Comment