The regex below is working for after the period. The part in fron is not working. It is requiring atleast 2 chars before the period which is not my rule. the rule for the front part:
start with [a-zA-Z0-9] chars following is [\w-] BUT IS OPTIONAL /^[a-zA-Z0-9][\w-]\.[a-zA-z]+$/ I think the regex is not doing the option \w part. Example, a.c is failing. it's suppose to be true. thanks > --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] > > ----------------------------------------- eMail solutions by http://www.swanmail.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]