943,598 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Marked Solved
  • Views: 895
  • Perl RSS
Feb 10th, 2009
0

regex not validating email

Expand Post »
as part of my assignment i'm trying to validate an email address stored in an hash, with the key: 'email' and the value as the data supplied. But the email is not getting validated using reg-ex:

Perl Syntax (Toggle Plain Text)
  1. if($form_element{'email'} =~ m/^[A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{2,4}$/i){
  2. $values = 0;
  3. $mail = "InValid!";
  4. } else {
  5. $mail = "Valid!";
  6. }
Similar Threads
Reputation Points: 10
Solved Threads: 8
Junior Poster
sid78669 is offline Offline
195 posts
since Nov 2008
Feb 10th, 2009
1

Re: regex not validating email

Perl Syntax (Toggle Plain Text)
  1. if($form_element{'email'} =~ m/^[a-zA-Z0-9_\-]+@[a-zA-Z0-9_\-]+([.][a-zA-Z0-9_\-]+)+[a-zA-Z]{2,4}$/i){
  2. $values = 0;
  3. $mail = "Valid!";
  4. } else {
  5. $mail = "InValid!";
  6. }
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Feb 10th, 2009
0

Re: regex not validating email

lol!! thanks alot!
Reputation Points: 10
Solved Threads: 8
Junior Poster
sid78669 is offline Offline
195 posts
since Nov 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: insert text
Next Thread in Perl Forum Timeline: OLE and Office 2007





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC