Valid phone number - Node.js Regular expression

Node.js examples for Regular expression:Validation

Description

Valid phone number

Demo Code


        phone : {/*from  w  w  w  .  jav  a 2 s .c  o  m*/
          validator : function(value) { 
              return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/i.test(value); 
          }, 
          message : 'use the following format:020-88888888' 
        },

Related Tutorials