PHP US phone, zip regular expression validator
Tech-Today

PHP US phone, zip regular expression validator


I want a format:

a.) phone: (xxx)-(xxx)-(xxxx)
b.) zip: (xxxxx)-(xxxx); -(xxxx) is optional

But, I couldn't find them so I created mine anyway.


$us_phone = "^(\()[0-9]{3}(\))(\-)(\()[0-9]{3}(\))(\-)(\()[0-9]{4}(\))$";
$us_zip = "^((\()[0-9]{5}(\)))(-(\()[0-9]{4}(\)))?$";

$code = $us_phone;

function validate($code, $value) {
if(ereg($validator, $value)) {
return true;
else
return false;
}




- How To Create A Custom Bean Validation In Javaee6
Bean validation has been mentioned on many articles online but I found few that explain the actual class that implements the constraint validator. For example: the bean validation article from  oracle javaee6 documentation: http://docs.oracle.com/javaee/6/tutorial/doc/gkfgx.html....

- Mvc3 Ajax Validation Doesn't Work On A Jquery Served Form
To make automatic validation using data annotation on a model on mvc3 c# we need: 1.) A model with data annotation (ex. required attribute). 2.) Form with jquery declaration (jquery1.7, validate, validate unobtrusive, and unobtrusive-ajax. All are available...

- Java.lang.nosuchmethodexception: Org.hibernate.validator.classvalidator
Note I'm using jboss-5.1.0.GA If you ever encounter the following error: Caused by: org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.(java .lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator,...

- Disable Nokia Shutter Sound - How To Disable The Shutter Sound Of Nokia Phones
If you've searched google you've probably found a suggestion to change something on your phone's file system. But I've got a different approach. Thought of developing a camera application for e51 but hey it's already available here:...

- Php_network_getaddresses: Getaddrinfo Failed: No Such Host Is Known.
Wondering how to disable the above error? Even if you set in your php.ini: display_errors = Off Errors will still pop out. Solution: Just add @ at the beginning of the function: $handle = @fopen($obj, "r"); @, suppress the warnings produced Php documentation...



Tech-Today








.