Matching with preg_match()
<? if (preg_match('/^\d{5}(-\d{4})?$/',$_POST['zip'])) { print $_POST['zip'] . ' is a valid US ZIP Code'; } $is_bold = preg_match('@<b>[^<]+</b>@',$html); ?>