Re: [OT] Regular Expressions

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 49879
interpreted = N
texte = Thanks John!That worked perfectly!I DID remove the 4 from the end in order to accommodate some of new long domains like .museum, etc.On 4/29/03 3:32 PM, John Peacock wrote:> Clint Davis wrote: >> I'm trying to use a regular expression in a javascript to test an email >> input field in a form like this: >> >> var goodEMAIL = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/ >> > > You will need to escape the period when it does not appear inside a set [] > since it is otherwise a match any single character term. Try this instead: > > var goodEMAIL = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/ > >> I thought this script was supposed to act as specified above, but I'm able >> to enter something like a@aaaa with no problems, but a@a.a fails. The 2-4 >> character check at the end doesn't appear to be working. I'm sure one of the >> veteran C programmers can answer this with no problem. >> > > The reason that a@a.a fails is that the 2-4 check _is_ working; you cannot > have > fewer than two characters in your TLD (corresponding to the ISO country > codes). > However, I think the {2,4} should be changed to {2,} since there may now be > domains longer than 4 characters (e.g. .museum). The reason that a@aaaa is > working is that you are actually matching it like this: > > (a)@(aa)(aa) > > because you didn't escape the period. --------------------------------------------------------------------- Clint Davis Webmaster / Interactive Media Specialist Gray Loon Marketing Group, Inc. http://www.grayloon.com 204 Main Street | Evansville, IN 47708 | Phone:812-422-9999 --------------------------------------------------------------------- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: [OT] Regular Expressions (Clint Davis 2003)
  2. Re: [OT] Regular Expressions (John Peacock 2003)
  3. [OT] Regular Expressions (Clint Davis 2003)
Thanks John!That worked perfectly!I DID remove the 4 from the end in order to accommodate some of new long domains like .museum, etc.On 4/29/03 3:32 PM, John Peacock wrote:> Clint Davis wrote: >> I'm trying to use a regular expression in a javascript to test an email >> input field in a form like this: >> >> var goodEMAIL = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/ >> > > You will need to escape the period when it does not appear inside a set [] > since it is otherwise a match any single character term. Try this instead: > > var goodEMAIL = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/ > >> I thought this script was supposed to act as specified above, but I'm able >> to enter something like a@aaaa with no problems, but a@a.a fails. The 2-4 >> character check at the end doesn't appear to be working. I'm sure one of the >> veteran C programmers can answer this with no problem. >> > > The reason that a@a.a fails is that the 2-4 check _is_ working; you cannot > have > fewer than two characters in your TLD (corresponding to the ISO country > codes). > However, I think the {2,4} should be changed to {2,} since there may now be > domains longer than 4 characters (e.g. .museum). The reason that a@aaaa is > working is that you are actually matching it like this: > > (a)@(aa)(aa) > > because you didn't escape the period. --------------------------------------------------------------------- Clint Davis Webmaster / Interactive Media Specialist Gray Loon Marketing Group, Inc. http://www.grayloon.com 204 Main Street | Evansville, IN 47708 | Phone:812-422-9999 --------------------------------------------------------------------- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Clint Davis

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

WebCatalog stalls (1998) Extra carriage returns (1999) WebCatalog NT beta 18 problem (1997) WebCatalog for Postcards ? (1997) RE: Signal Raised (1997) WebCat2b15MacPlugin - showing [math] (1997) Banners (1997) OT: Flash developer needed (2007) I've been framed by webcatalog! Does anyone know the way out? (2000) [redirect..] (2006) WebCat 4.0.1 HTTP_REFERRER over 255 char bug (2000) WebCat2b15MacPlugin - [protect] (1997) Rendering out a page (1997) Verifying SSL on Page (2002) The evolved Server Configuration Queston (2000) Multiple Pulldowns (1997) Alternating colors (1997) WCS Newbie question (1997) timing out? (1997) WebDNA 5.0 Questions (2003)