regex to check for a valid regex pattern in php -


I am trying to write a verification class in php and have a snag. I am using the following code to check a value against a defined regex pattern, but when I try to run the script I get an error message:

"Warning: preg_match ( ) [Function.preg-match]: Can anybody face my mistake?

  Public function is_regex (  

$ Var, $ {$ Valid = (bool) preg_match ($ expression, $ var); if ($ valid == incorrect) {return $ $ {$ ($ trim ($ var) Msg}}}}

and I am using it to call the function

  array ('type' = & gt; 'Regex', 'Var' = & gt; $ _ POST [ 'Test'], 'expression' => [[AZA-Z] {1,20} $ ',' message '= & gt;' expression does not match ')    

As far as I see, you must include regexp in attachment characters, for example. Array

  array ('type' = & gt; 'Regex', 'Var' = & gt; $ _ POST ['test'], 'expression' = & gt; | [A-Za-z] {1,20} $ | ',' Message '= & gt;' Expression does not match ')   

You can also define a character in the function, but in this case if you have this character in Reggexpy, then you have to save it

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -