topical media & game development

talk show tell print

basic-regex-23-XModifier.php / php



  <html>
  <head>
  <title>The x matching modifier in use.</title>
  </head>
  <body>
  <?php
  US_SSN = "123-12-1234";
  myMatch = preg_match("/
   \d{3} # Matches three numeric digits
   -     # Matches a literal hyphen
   \d{2} # Matches two numeric digits
   -     # Matches a literal hyphen
   \d{4} # Matches four numeric digits
  /x", "123-12-1234", theMatch);
  echo "<p>The test string was: 'US_SSN'.</p>";
  echo "<p>This matches the pattern /\d{3}-\d{2}-\d{4}/</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.