--On Friday, October 10, 2003 16:43 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

rules:
starts with alphanumeric
3 chars long

Note, so we are not confused: you mean _at least_ 3 chars long. (Not _only_ 3 chars long.)


require ONLY one period
require alpha after the period

Ok, what exactly do you mean here? Is this: a. Require _only_ alpha after the period? b. Require _the next char_ to be alpha?

Either one is possible from your description, and could be a big difference.

/^[a-zA-Z0-9][\w-].[a-zA-z]/ #but now working

sub validate {
    local $_ = shift;
    return( length >= 3 and
            tr/.// == 1 and
            /^[[:alpha:]]/ and
           /[a-zA-Z0-9].[a-zA-Z]/ ); #added here still not working
}

That last line says: Match one character (alpha or numeric only) then any character, then a single alpha character.


If you want the _next_ character to be alpha, the following should work:
/\.[[:alpha:]]/


If you want _only_ (and at least one) alpha after the period, you need this:
/\.[[:alpha:]]+$/


Hope this helps.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to