> Being JSON immediately parsable by both Javascript and PHP it is > possible to exploit it to keep the regular expressions for the input > fields in a single place, and avoid mantaining them synched between the > Js and PHP scripts! Yes, but... The Regex engines are not the same, so you have to keep it to simple simple simple expressions that "work" for both. I've done this before, actually, without the JSON part. //apologies to mathematicians for calling it "int" $int_pattern = '^[0-9]+$'; $errors = array(); if (!preg_match($int_pattern, $_REQUEST['foo']){ $errors['foo'] = "foo must be a number"; } /* ... */ if (count($errors[])){ //re-display form with errors highlighted etc } else{ //move along } ?> <script type="text/javascript"> var int_pattern = <?php echo $int_pattern?>; function validate(){ } </script> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php