D
D
DieZz2015-03-23 14:59:18
Laravel
DieZz, 2015-03-23 14:59:18

How to fix regular expression validation error in Laravel 5?

Good day. I am learning Laravel. When validating data, forms will run into a problem. One of the fields needs to be checked against a regular expression. The corresponding validator method is present in the documentation, but when executed, I catch an exception that this method is missing.


BadMethodCallException in Validator.php line 2615:
Method [validateRegexp] does not exist.

static public $rules = array(
            'node'     	=> array(
                            'required',
                            'unique:com_object',
                            'regexp:/^ПРП\w+-\w+$|^АО\w+$|^ПВН\w+-\w+$/i'
                           ),
 			'street'    => 'required'
          );

...

$validation = Validator::make($data, Node::$rules,Node::$messages);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2015-03-23
@DieZz

Because it's called regex .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question