Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

regular expression for email and mobile

$email=$_POST['email'];

$emailPattern = '/^w{2,}@w{2,}.w{2,4}$/'; 
$mobilePattern ="/^[7-9][0-9]{9}$/"; 

if(preg_match($emailPattern, $email)){
    echo "Email Success!";
} else if(preg_match($mobilePattern, $email)){
    echo "Mobile Success!";
} else {
    echo "Invalid entry";
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: discord js if no arguments 
Javascript :: nodejs s3 list objects from folder 
Javascript :: addeventlistener classlist toggle dom 
Javascript :: split in javascript 
Javascript :: how to handle errors with xmlhttprequest 
Javascript :: clearinterval javascript 
Javascript :: javaScript setDate() Method 
Javascript :: mongodb add 1 to field 
Javascript :: react vscode stop auto close tag 
Javascript :: js json escape 
Javascript :: remove from string javascript regex 
Javascript :: vue nested loop 
Javascript :: name first letter uppercase 
Javascript :: clone a JavaScript object 
Javascript :: socket emit to 
Javascript :: testing a function in jest on click react 
Javascript :: change the color of toast toastr js 
Javascript :: NodeJS 10.24.1 
Javascript :: async await javascript push 
Javascript :: look up asciii value javascript 
Javascript :: luxon plus 
Javascript :: Create Your Own Node Module 
Javascript :: create global variable inside function JavaScript 
Javascript :: execute shell command in javascript 
Javascript :: prisma user counter 
Javascript :: js number padding to number of characters 
Javascript :: express cookieparser 
Javascript :: destructuring in es6 
Javascript :: momentum 
Javascript :: javascript double question mark 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =