PHP Function preg_match

preg_match – this function is used to perform a pattern match on a string. It returns true if a match is found and false if a match is not found.

            preg_match($pattern2search, $subject2search);

This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Use the === operator for testing the return value of this function.
 We can use this function to search for any patterns. I have used it to search text inputs for any code injections.

For more information check:

https://www.php.net/manual/en/function.preg-match.php


demo

  • PHP
  • Includes: index.html, email2.php and CSS file
Please check for future updates here or at my gitHub page.