PHP - Convert ereg to preg_match -


i know seems not difficult php experience basic .

foreach ($name $name)  { if (preg_match("^\.",$name)) { echo "bla bla bla";  die(); } if (preg_match("\<", $name)) { echo "bla bla bla";  die(); } if (preg_match("\[", $name)) { echo "bla bla bla";  die(); } if (preg_match("\`", $name)) { echo "bla bla bla";  die(); } } 

in case, can simple make use of strpos() , === operator, or substr(). don't need regular expressions match constant strings.

if want keep current code, have enclose expressions delimiter of choice. these valid:

'/^\./' '@^\.@' '#^\.#' 

you can find further info @ pattern syntax , differences posix regex.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -