0
Q:

preg_match

<?php
//Syntex : int preg_match( $pattern, $input, $matches, $flags, $offset)
  
// Declare a variable and initialize it 
$str = "Check For Testing."; 
  
// case-Insensitive search for the word "Check" 
if (preg_match("/\bCheck\b/i", $str, $match))  
    echo "Matched!"; 
else
    echo "not matched";   
  

// Output : Matched
?>
1
preg_match('/(foo)(bar)(baz)/', 'foobarbaz', $matches, PREG_OFFSET_CAPTURE);
3
if(!preg_match('/^\[a-zA-Z]+$/',$input)) {
   // String contains not allowed characters ...
}
0
if (preg_match("/\bweb\b/i", "PHP is the web scripting language of choice.")) {
    echo "A match was found.";
} else {
    echo "A match was not found.";
}
0
preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] ) : int
1

New to Communities?

Join the community