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

Comments

Popular posts from this blog

ng-show doesn’t work correct with value boolean

ng-include of inline SVG does not display gradient except in Chrome

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development