473,569 Members | 2,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reg Expression - valid International email addresses?

Can anyone please help me with a regular expression
to test for Valid International Email Addresses?
Also, which version of javascript (1.2 ?) is needed for same?

Thanks.
Regards.
Jul 20 '05 #1
14 8312
nagual wrote:
Can anyone please help me with a regular expression
to test for Valid International Email Addresses?


Yes, I know this says "Perl", not "JavaScript " but read it anyway. OK?

http://www.perldoc.com/perl5.8.0/pod...-mail-address-

--
David Dorward http://david.us-lot.org/
Redesign in progress: http://stone.thecoreworlds.net/
Microsoft announces IE is dead (so upgrade):
http://minutillo.com/steve/weblog/20...ces-ie-is-dead
Jul 20 '05 #2
The following uses regular expressions adapted from Jeffery Friedl's
book to check the format of an email string.

rxEmail =
/^\w[-.\w]*\@[-a-b0-9]+(?:\.[-a-b0-9]+)*\.(?:com|edu |biz|org|gov|in t|inf
o|mil|net|name| museum|coop|aer o|[a-z][a-z])\b/;

Convert to lower case before testing.

rxEmail.test(em ail.toLowerCase ());

Note that the pattern used non-capture parenthesis which are available
in IE5.5+ and JavaScript 1.5. For older browsers like NN4 replace (?: by
( in the above expression.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
On 12 Jul 2003 16:27:45 GMT, Mark Szlazak <an*******@devd ex.com>
wrote:
The following uses regular expressions adapted from Jeffery Friedl's
book to check the format of an email string.

rxEmail =
/^\w[-.\w]*\@[-a-b0-9]+(?:\.[-a-b0-9]+)*\.(?:com|edu |biz|org|gov|in t|inf
o|mil|net|name |museum|coop|ae ro|[a-z][a-z])\b/;

Convert to lower case before testing.

rxEmail.test(e mail.toLowerCas e());

Note that the pattern used non-capture parenthesis which are available
in IE5.5+ and JavaScript 1.5. For older browsers like NN4 replace (?: by
( in the above expression.


My email address has a + in it, you don't seem to list that one
above...

Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #4
Well, then just put the + in.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #5
Mark Szlazak wrote on 12 jul 2003 in comp.lang.javas cript:
Forgot one thing. If you only want international emails then modify the
regex to:

rxEmail =/^\w[-.\w]*\@[-a-b0-9]+(?:\.[-a-b0-9]+)*\.[a-z][a-z]\b/;


..int

as in:

http://www.who.int/

is THE international domain postfix.
..uk, .nl, .ca, etc are the NATIONAL ones
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #6
On 13 Jul 2003 04:37:37 GMT, Mark Szlazak <an*******@devd ex.com>
wrote:
Well, then just put the + in.


and all the thousands of other legal characters... that's the problem
you're missing. I wouldn't bother with the validation at all... as
all you'll do is get a junk valid-looking email address, rather than
simply an incorrect one.

Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #7
If your seeking perfection and want to get all those "thousands" of
emails then speak to God.
I'm sticking with pragmatic solutions.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #8
On 13 Jul 2003 14:57:45 GMT, Mark Szlazak <an*******@devd ex.com>
wrote:
If your seeking perfection and want to get all those "thousands" of
emails then speak to God.
I'm sticking with pragmatic solutions.


Because of the + in my email address being rejected, I've not done
over 3000 UKP worth of online business with various online agencies
this year (mostly computer equipment and travel.) now you may be
happy to throw away that business, after all I'm just one bloke right?
but are your clients fully aware?

Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/

Jul 20 '05 #9
JRS: In article <3f************ *********@news. frii.net>, seen in
news:comp.lang. javascript, Mark Szlazak <ms******@aol.c om> posted at
Sat, 12 Jul 2003 21:07:39 :-
Forgot one thing. If you only want international emails then modify the
regex to:

rxEmail =/^\w[-.\w]*\@[-a-b0-9]+(?:\.[-a-b0-9]+)*\.[a-z][a-z]\b/;


International does not mean foreign; it includes America. Indeed, the
OP seems to be Australian. Some US E-mail addresses end, I believe, in
..us, as is right and proper. Many non-US ones end in .com or .net, too.

The existence of a national indication in most cases implies a
significant connection with that country, with certain well-known
exceptions; the converse is not true.

Don't believe all that you read in books; even if it was good when
written, which is uncertain, the facts might have changed.

There is little point in doing much validation on an E-address.

It is *impossible* to tell, other than by hearing of delivery, that an
E-address is deliverable to; I can change the rules at this site while
not connected to the Net. Attempted exact validation risks false
negatives (so it needs to be possible to send to an address that the
test actually rejects) and false over-confidence.

ISTM that the only reasonable validation is one checking that the field
is non-empty and that its contents match the minimum requirements; that
will deal with cases where some other piece of information is entered.

/.+@/+\..+/ seems about as strong a test as is appropriate; if I have
it right, check for something @ something . something .

E-address validation must be a FAQ candidate; it could provide a basis
for an entry on RegExps.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3322
by: Hoang | last post by:
anyone know of an algorithm to filter out real email addresses as opposed to computer generated email addresses? I have been going through past email archives in order to find friends email address. Unfortunately about 75% of them are junk addresses or spammer addresses. It's quite obvious when you look at it and delete it... but you don't...
9
1920
by: Holden Caulfield | last post by:
Hello! Does anyone know a good archive for all different types of Regular expressions? I am 90% done a website and the last 10% is putting validation on over 100 fields. They range from needing to: - verify valid email (I already have this reg exp) - verify hexadecimal number - verify name would be valid as a filename - phone number
2
18064
by: Bryce Budd | last post by:
Hi all, I am trying to use a regular expression validator to check for the existence of PO Box in an address textbox. The business rule is "No addresses with PO Boxes are allowed." What I want to happen is the Regular Expression Validator to return false only when the string contains PO Box. Currently it is false even when a valid...
0
1532
by: Conference Secretary | last post by:
CALL FOR PAPERS International Conference on Intelligent Agents, Web Technologies and Internet Commerce http://www.ise.canberra.edu.au/conferences/iawtic05/ Jointly with International Conference on Computational Intelligence for Modelling, Control and Automation
12
3736
by: laurenq uantrell | last post by:
Is there an easy way to loop through all rows and remove all international alphabet characters from a column in a table, for example remove German umlauts "ü" and convert them to a simple "u". Thanks, lq
0
2188
by: avinash | last post by:
International Conference on Computational Intelligence and Multimedia Applications, August 16-18, 2005 University of Nevada, Las Vegas, USA (www.iccima.org) F I R S T C A L L F O R P A P E R S The International Conference on Computational Intelligence and Multimedia Applications will be held at the University of Nevada, Las...
6
489
by: JohnSouth | last post by:
Hi I've been using a Regular expression to test for valid email addresses. It looks like: \w+(\w+)*@\w+(\w+)*\.\w+(\w+)* I've now had 2 occassions where it has rejected and email address with a "&" character in the local part. I know I should be able to work it out myself, but I'd like to ask anyone to suggest the best way to
2
2769
by: Ramesh | last post by:
I have a reguar expression syntax that works fine when used in a RegularExpressionValidation control. If I use the exact same regular expression using System.Text.RegularExpressions.Regex to validate, it doesn't catch all invalid formats. This is for validating a single line text with multiple email addresses. Validation conditions apart...
12
4840
by: ll | last post by:
I am trying to finalize a regular expression in javascript to only allow emails with a certain domain to be valid. Here is what I have so far: var emailFilter2=/\@aol.com/; if(!(emailFilter2.test(strng))) { error = "Please enter a valid email address with the AOL domain.\n \n"; }
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.