Skip to main content

Posts

Showing posts with the label Regular Expression

Regular Expression For Javascript

For Email :   /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/ For Name (Only For Alphabetic) : /^[-_ a-zA-Z]+$/ For Phone Number (Atleast 5 characters,With (+) Sign) : /^[+ 0-9]{5,15}\s*$/ For Textarea or Message : /^[a-zA-Z][;,-_ a-zA-Z0-9]+$/ For Alpha Numeric (Not Allowed Integer) : /^(?![0-9]*$)[-_ a-zA-Z0-9]+$/ For Test: You can store above regression in variable and then check it is valid or not.For example... var letters = /^[-_ a-zA-Z]+$/; if(letters.test(name)) {        return true; }else{       return false; }