A simple use of preg_match() : String Matches « String « PHP






A simple use of preg_match()

<?php
     $string = "PHP is the web scripting language";
     $pattern = "/PHP/";
   
     if(preg_match($pattern, $string))
          print("Found a match!");
?>

           
       








Related examples in the same category

1.String match for domain name
2.String matches: ^ (begine)
3.String match demo: /[cd][oa][gt]/
4.String match demo: |
5.$: anchors a pattern to the end of a line or the end of the string
6.String matches: string start
7.String match and if statement