lundi 22 août 2016

Php Regular Expression /^d{10}$/;

Am trying to update a PHP script which has this code:

function CheckNumber(MyNumber)
{
    var MN = /^d{10}$/;
    if (MN.test(MyNumber)) {
        return true;
    }
    return false;
}

I think the script above force entry of 10 digits. nothing less and nothing more.

I need to fix it with the condition - not more than 12 digits - also allows less than 12 digits. - no special characters.

Please help. I don't understand regular expression codings.

Aucun commentaire:

Enregistrer un commentaire