Validating AppleScript input text How would I validate this pattern: 2 digits followed by last name, basically any length of letters.  Apple script does not use regular expressions, correct?  

I need to validate user input and all student user IDs on my campus are in that format.

repeat

    display dialog "Enter  user name:  (like 99smith)" default answer "" giving up after 40

    set {userName, returnedButton, gaveupBoolean} to the result as list
    --&gt;{"some text", "OK", false}

    if userName is not "" then
        set CheckName to text 1 thru 2 of userName &amp; " --test"

        display dialog CheckName &amp; " -- 1"

        if class of CheckName is number then

            display dialog CheckName &amp; " -- 2"
            exit repeat
        else
            display dialog "Name does not start with 2 digits  " &amp; CheckName &amp; " -- " &amp; userName
        end if

    end if

end repeat
Can you approach it like this:

Take the first two characters:

--test to see if they are numbers.
-->If not return invalid.

Take the remaining characters:

--test for minimum length?

--> if not return invalid.

--test each character to see if they are numbers.

-->  If any character is a number return invalid.

Edit to add:

Rather than checking to see if CheckName is a number try converting it to a number:

try
    set CheckName to CheckNameDigits as number
on error
    display dialog CheckName &amp; " is not a number"
end try