774 snippets from 1587 members, and growing!
|
login
|
join
about
bytebin
members
tags
snippets
join
Snippets
Submit a Snippet
Search Snippets
New Snippets
Top Snippets
Top Tags
PHP
(138)
JavaScript
(125)
Java
(66)
VBSCRIPT
(58)
String
(44)
CSS
(31)
CSharp
(28)
File
(28)
HTML
(27)
mysql
(25)
C
(24)
VB.NET
(24)
python
(24)
CPlusPlus
(23)
groovy
(23)
New Snippets
Clean PHP Templat...
PHP/MySQL impleme...
Analyte - Easy to...
Easy SQLite inter...
Very lightweight ...
AutoComplete plug...
AutoComplete plug...
Connection Java -...
View PostgreSql
Store Procedure
Venture Capital Jobs
New Members
me
jamesmcm
Can
Kelmi
ysg
dannymo2
chorny
wallie
Hackdemian
impomatic
Top Members
dannyboy
sundaramkumar
mattrmiller
Pio
i_kenneth
ASmith
ctiggerf
sehrgut
bertheymans
SCoon
Home
/
Snippets
/
Validate email with regexp
/
Comments
Validate email with regexp
Snippet Menu
Revisions
Comments
Related Snippets
Add to Favorites
Email Snippet
Download Snippet
Print Snippet
Blog Snippet
snippet
|
revisions
|
comments
|
related
|
Add to Favorites
|
email
download
|
print
|
blog it
New Comment
With the help of PHP
Thu. Jul. 27th, 2006 5:25 AM
rastersize
Here is some code to validate an email address with PHP:
function isEmail($email)
{
return preg_match('/^(([^()[\]\\.,;:\s@"\']+(\.[^()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email);
}
Btw. This regexp string is a litle better than the one proposed by the snippet author.
And for all of you who just wants the regexp and really can't read or hate to read PHP code, here it is:
^(([^()[\]\\.,;:\s@"\']+(\.[^()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$
-----------------------
http://jiart.org/
My digital playground
with it's own
sandbox
.
Well anyway, I love programming
Reply
Perfect script here
Thu. Jul. 27th, 2006 7:46 AM
rastersize
If you want a perfect email validation script, http://examples.oreilly.com/regex/email-unopt.txt there you have it, written in PERL.
-----------------------
http://jiart.org/
My digital playground
with it's own
sandbox
.
Well anyway, I love programming
Reply
New Comment
function isEmail($email)
{
return preg_match('/^(([^()[\]\\.,;:\s@"\']+(\.[^()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email);
}
Btw. This regexp string is a litle better than the one proposed by the snippet author.
And for all of you who just wants the regexp and really can't read or hate to read PHP code, here it is:
^(([^()[\]\\.,;:\s@"\']+(\.[^()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$
-----------------------
http://jiart.org/
My digital playground with it's own sandbox.
Well anyway, I love programming
-----------------------
http://jiart.org/
My digital playground with it's own sandbox.
Well anyway, I love programming