Answers for "What is a Regular Expression in php"

PHP
3

regex php

<?php
// First Verif your regex code with https://regex101.com/
$str = "Visit W3Schools";
$pattern = "/w3schools/i";
echo preg_match($pattern, $str); // Outputs 1

// test email with REGEX
if (!preg_match("/[-0-9a-zA-Z.+_]+@[-0-9a-zA-Z.+_]+.[a-zA-Z]{2,4}/", $emailAddress)){
    //Email address is invalid.
}

// use filter var to valide Email
if(filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) 
{
     //The email address is valid.
} else{
     //The email address is invalid.
}


?>
Posted by: Guest on November-02-2020
2

php regex

preg_match('/(foo)(bar)(baz)/', 'foobarbaz', $matches, PREG_OFFSET_CAPTURE);
Posted by: Guest on April-03-2020
0

What is a Regular Expression in php

A regular expression is a sequence of characters that forms a search pattern.
Posted by: Guest on December-21-2020

Code answers related to "What is a Regular Expression in php"

Browse Popular Code Answers by Language