Issue with Laravel Rules & Regex (OR) operator
http://laravel.com/docs/validation#rule-regex
regex:pattern
The field under validation must match the given regular expression.
Note: When using the regex pattern, it may be necessary to specify rules in an array instead >of using pipe delimiters, especially if the regular expression contains a pipe character.
To clarify:You would do something like this
$rules = array('test' => array('size:5', 'regex:foo'));
I use this style and save my life :-)
change code from
$validator = Validator::make( $request->all(), [ 'name' => 'required|string', 'initial_credit' => 'required|integer|between:0,1000000|regex:/[1-9][0-9]*0000$/' ] ]);
to
$validator = Validator::make( $request->all(), [ 'name' => 'required|string', 'initial_credit' => [ // <=== Convert To Array 'required', 'integer', 'between:0,1000000', 'regex:/([1-9][0-9]*0000$)|([0])/' // <=== Use pipe | in regex ] // <=== End Array ]);