Check for specific input vali format with Javascript : I have a field for danish social security number that have to be validated for the correct format which is 123456-1234.

I am not sure how to check for this value in Javascript.

I am adding a method to jQuery Validator


        $.validator.addMethod("cprFormat",function (value,element){
         
         var validFormat = /^[0-9]+$/;
    
         var cprNoValue = $("#cprNo").val();
    
        return validFormat.test(cprNoValue);
    
    }, 'CPR-nummer er ikke gyldigt');

But I am missing the correct regex in validFormat var
