0

I have the following check in my Javascript code.

if(someValueToCheck.replace(/[^0-9]/g,"").length>13){
    return "Invalid"
}

My question is if it is possible to combine this into a single regex. I am planning to plug that regex directly to a ember-cp-validations library using something like below;

    validations['my-custom-regex'] = {
      'with': myfield.regex, //Consolidated regex from above
      'allowBlank': true,
      'message': message
   };
Nir Alfasi
  • 53,191
  • 11
  • 86
  • 129
copenndthagen
  • 49,230
  • 102
  • 290
  • 442

0 Answers0