FILTER_VALIDATE_REGEXP

By using FILTER_VALIDATE_REGEXP we can validate Regular expression .
$string = "Welcome to plus2net.com";

var_dump(filter_var($string, FILTER_VALIDATE_REGEXP,
array("options"=>array("regexp"=>"/^W(.*)/"))))
Output is
string(23) "Welcome to plus2net.com"
Change the $string variable value to
$string="ZWelcome to plus2net.com";
Output is now
bool(false)

Example 2

$string = "Welcome to plus2net.com"; // change the first char and see the result

if(filter_var($string, FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^W(.*)/")))){
echo "yes Cleared ";	
}else{
echo " No not cleared ";	
}
Output is here
yes Cleared


plus2net.com




Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer