simple regex validation fails

Posted 1 year ago by jahstation

I need a way to add a regex to a validator, but it seem a little bit problematic to me, even I followed as described in the doc to put all rules on array.

I need that my password can contain at least (or more) these symbols " [][email protected]$*()_-=?;':",. "

so the regex to me is something like [list of symbols]

I write my code as:

$rules = array(
        'password' =>array('required',
        'min:6','confirmed',
        'regex:[[email protected]$*()_=?;\':\",.]'),
        'userName'=> array('required','min:3','max:25'),
        'email' => array('required','email'),
        'type' => array('required','max:13'),
    );

but every time an error is raised!

(1/1) ErrorException preg_match(): Compilation failed: nothing to repeat at offset 3 in ValidatesAttributes.php (line 1050)

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.