fork download
  1. <?php
  2. $testString = "Buy Widgets 20% discount with coupon code WID2010 by Friday";
  3. preg_match("/(?=\w*[a-z])(?=\w*[0-9])\w+/i", $testString, $matches);
  4. print_r($matches);
  5. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Array
(
    [0] => WID2010
)