Field Action On User Input - requirement for field

Field Action On User Input - requirement for field

Is there a way to check the user's input for a certain field critera?  Field value needs to be at least 12 characters long and has to be in alphanumeric format.  It can contain special characters.  I've been at this for a couple days now.  Thank you in advance for any help ... Cheers!

Here's what I have so far ...
if(input.field.length() <= 11)
{
alert "Field Entry MUST be at least 12 characters and alphanumeric.";
}
else
{
Field_Formatted = input.field;
}