regex - preg_match(): No ending delimiter '/' found -


$this->form_validation->set_rules('ttime','time', 'required|regex_match[/^(0?[1-9]|1[012])(:[0-5]\d)$/]'); 

my regex correct still shows , error severity: warning

message: preg_match(): no ending delimiter '/' found

filename: libraries/form_validation.php

line number: 911

ran problem well. issue indeed pipe | character codeigniter uses, adding single quotes didn't me. try:

1) passing array of rules instead of piped string:

$this->form_validation->set_rules('field',                                   'field name',                                     array('required','regex_match[/your-regex/]')) 

2) creating custom callback use rules pointed out here:

    function my_func ($field) {             return (bool)preg_match('/your-regex-here/', $field);     }      $this->form_validation->set_rules('field','field name', 'required|my_func'); 

3) can use anonymous function combination of 1 & 2

check out documentation , hope helps.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -