topical media & game development

talk show tell print

basic-regex-23-EregEregiTest.php / php



  <html>
  <head>
  <title>ereg() and eregi() Test to match [A-Z][0-9]</title>
  </head>
  <body>
  <?php
  myPattern = '[A-Z][0-9]';
  testString = "a9";
  myResult = ereg(myPattern, testString);
  if (myResult)
  {
  echo "<p>A match was found when testing case sensitively.</p>";
  } 
  else
  {
  echo "<p>No match was found when testing case sensitively.</p>";
  }
  myResult2 = eregi(myPattern, testString);
  if (myResult2)
  {
  echo "<p>A match was found when testing case insensitively.</p>";
  } 
  else
  {
  echo "<p>No match was found when testing case insensitively.</p>";
  }
  ?>
  </body>
  </html>


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.