Filling Patterns with ereg : ereg « String « PHP






Filling Patterns with ereg

 
<?php

    $s = 'm@t.ca';

    if (ereg ('([[:alpha:]]+)@([[:alpha:]]+)\.([[:alpha:]]{2,4})', $s, $matches))
    {
      echo "Regular expression successful. Dumping matches\n";
      var_dump ($matches);
    }
    else
    {
      echo "Regular expression unsuccessful.\n";
    }

?>
  
  








Related examples in the same category

1.Capturing Text Inside HTML or XML Tags
2.Displaying elements of $regs array
3.ereg() function searches a string, returning true if the pattern is found, and false otherwise.
4.ereg.php
5.break $url down into three distinct pieces