Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$pattern = "/^[a-z \-,.:']+$/i";
if ( preg_match($pattern, $subject) === 0 ){
echo 'invalid form field';
}
<?php
$pattern = "/^[a-z \-,.:']+$/i";
$subject[] = "I am a test string";
$subject[] = "I am a John O'Connor";
$subject[] = "I am a test with illegal [characters]";
foreach($subject as $s){
if(preg_match($pattern, $s) === 0 ){
echo "string not matched";
} else {
echo "string matched";
}
echo "<br/>";
}
?>
string matched
string matched
string not matched