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

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"? - development

CORS issue between web/android/ios

Angular.js ng-click with mouse middle button