Answers for "how to use preg_match() in php"

PHP
0

preg_match in php

<?php
$my_email = "[email protected]";
if (preg_match("/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+.[a-zA-Z.]{2,5}$/", $my_email)) {
echo "$my_email is a valid email address";
}
else
{
  echo "$my_email is NOT a valid email address";
}
?>
Posted by: Guest on October-29-2020
0

preg_match

if(!preg_match('/^[a-zA-Z]+$/',$input)) {
   // String contains not allowed characters ...
}
Posted by: Guest on March-23-2020

Code answers related to "how to use preg_match() in php"

Browse Popular Code Answers by Language