PHP Regex

Regex Tutorial:

Best Site To Learn Tutorial (Will start from this page other pages completed before)


example from regex

$has_matches = preg_match($pattern, $input_str, $matches_out)
// Lets use a regular expression to match a date string. Ignore
// the output since we are just testing if the regex matches.
$regex = "/[a-zA-Z]+ \d+/";
if (preg_match($regex, "June 24")) {
    // Indeed, the expression "[a-zA-Z]+ \d+" matches the date string
    echo "Found a match!";
} else {
    // If preg_match() returns false, then the regex does not
    // match the string
    echo "The regex pattern does not match. :(";


It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *