Phone number validation, indexOf

Hello,

I need some help with validating a phone number. I want to check if the length of the number is ten chars and if the first number is a “0” and the second number a “6”.

This is my code so far.

form.send.onRelease = function() {
    yournumber = form.number.text;
    if (yournumber == null || yournumber == ""){
        trace ("no number");
    }
    if (yournumber.length !=10|| yournumber.indexOf("0") == -1 || yournumber.indexOf("6") == -1) {
        trace ("non existent number");
    }
}

This only checks if there is a “0” and a “6”, but not if they are the first and second char in the string.

Thanks for your help!

Jerryj.