SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Washington DC
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HELP: regular expression crashing

    Code:
    <!-- returns 1 if it's a valid email address, 0 or more if invalid --->
    
    <cfset validation_string = "[a-z0-9]+([\.\_\-]?[a-z0-9]+)*@([a-z0-9]+([\.\-]?[a-z0-9]+)*)+[\.][a-z]{2,}$">
    
    #REFindNocase(validation_string,email)#
    this code is crashing when email is:

    "user@email.com(joe schmoe)"

    or

    "user@email.com. "

    I can't figure out why. Any ideas?

    Han

  2. #2
    SitePoint Zealot easyrew's Avatar
    Join Date
    Nov 2001
    Location
    Milton Keynes, UK
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    crashing = what?

    Can you let us see an error message?
    I'm no good at Regular Expressions (gasp!) but it might shed some light and enable someone to help (maybe even me!).

    Rich
    If a man stands alone in the forest
    and there's no woman around to hear him,
    is he still wrong?
    w: www.EasyRew.com

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Washington DC
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what i meant by crashing, is that the page wouldn't load up.
    no error, no wrong output, it just would just hang there.

    anyway, this code works.

    Han
    Code:
    [a-z0-9]+([\.\_\-][a-z0-9]+)*@([a-z0-9]+([\.\-][a-z0-9]+)*)+[\.][a-z]{2,}$


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •