1 2 3 |
jQuery.validator.addMethod( "date", function( value, element ) { return this.optional( element ) || /^(19|20)\d{2}\/(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])$/.test( value ); }, "Please enter date format eg.mm/dd/yyyy" ); |
PHP
1 2 3 4 5 6 7 8 9 10 11 |
<?php $line = "13/20/2017"; // perform a case-Insensitive search for the word "Vi" if (preg_match("/^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/", $line)) { print "Match found!"; }else{ print "No Match found!"; } ?> |