topical media & game development

talk show tell print

basic-regex-23-preg-match-all-Insensitive.php / php



  <html>
  <head>
  <title>Using preg_match_all()</title>
  </head>
  <body>
  <?php
  testString = "A99 B888 C234 D123 E45678 f2345";
  myMatches = preg_match_all("/[A-Z]\d{1,5}/i", testString, partNumbers);
  if (myMatches)
  {
   for(counter=0; counter < myMatches; counter++)
   {
     echo "<p>" . partNumbers[0][counter]. "</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.