R
E
S
O
U
R
C
E
S
       Question Index      Products & Services      Contact Us      Links


WebHatchers will design & develop your site for you.
_______________________

Website Menu Heaven: side or top popup menus, buttons, image rotators, navbars, tons more.
_______________________

Send us your questions and wittiest comments.
_______________________

Report errors on our site.
_______________________

Share your neatest DHTML examples with us; we may publish them.
_______________________


_______________________

      QUESTION INDEX      

Question Index
Browser Insanity
JavaScript
Animation
Buttons and Menus
CSS and HTML
PHP
Personal Status Boards
Content Management
   Systems
Article Content
   Management Systems
Website Directory
   CMS Systems
Photo Gallery CMS
Forum CMS

 INFORMATIVE ARTICLES 

Menus-and-Buttons-
Part-I.htm


Menus-and-Buttons-
Part-II.htm


Change-Div-Size-Color-
and-Location-with-the-
W3C-DOM.htm


Bouncing-Ball-Animation-
with-the-W3C-DOM.htm


Style-Changes-with-the-
W3C-DOM.htm


Animation-with-the-
W3C-DOM.htm


Window-Play-and-Some-
Important-DOM-Methods.htm


Using-getElementsByTagName
-and-getElementsByName.htm


The-CSS-Resources-Intro-
Page.htm


Convert-Word-Files-to-HTML-
and-Install-Editor2-to-
Use-Instead-of-NotePad.htm


CSS-Issues.htm

What Are Fifteen Simple Methods of Doing Web-Page Pop-ups?

Security levels from Javascript and PHP input filtering

What is a regular expression general input validator?

What is a regular expression user name validator?

What is a regular expression password validator?

What is a regular expression email validator?

What is a regular expression URL validator?

How can I convert a Javascript array to a PHP array?

How can I Dynamically Create Input Boxes with Validation?

How do I use JavaScript Object Notation (JSON) in PHP and JavaScript to convert strings and arrays from PHP to JavaScript?

How do I add html to a web page with JavaScript, PHP or ssi includes?

How do I add html to a web page with JavaScript includes?


PHP

How do you put PHP variables in URL and link text?

What is PHP Code for Multiple PSB Hosts?

What is Registration PHP Code for Multiple PSB Hosts?

What is Registration PHP Code for Multiple PSB Hosts with a captcha?

What is Administrator PHP Code for Multiple PSB Hosts?

What's the PHP code for a script for a PSB?

What's the PHP code for a script for PSB updating?

What's the PHP code for a script if you forgot your user name?

What's the PHP code for a script if you forgot your password?

What's the PHP code for a script to change a member's email address?

What's the PHP code for a script to connect to a MySQL database?

What's the PHP code for a script to close a member's account?

What's the PHP code for a script to edit group member?

What's the PHP code for a script to add group member?

What's the PHP code for a script to reset a MySQL table's data to its original?

What's the PHP code for a script to edit a MySQL table's data?

What's the PHP code for a script to change a username?

What's the PHP code for a script to change a password?

What's the PHP code for a script to delete group member?

What's the PHP code for a script to view membership data?

What's the PHP code for a script to change an administrator's password?

What's the PHP code for a script to logout?

What's the PHP code for a script to login?

Security levels from Javascript and PHP input filtering

Security levels and PHP

How can I convert a Javascript array to a PHP array?

What is PHP Code to Prevent Duplicate Data Input - Like User Names or Members?

What is PHP Code for PSB Status Update for Multiple PSB Hosts?

How do I sort 1 PHP array and have the other arrays sort in parallel to how the first array sorts?

How do I use JavaScript Object Notation (JSON) in PHP and JavaScript to convert strings and arrays from PHP to JavaScript?

How do you do PHP-to-JavaScript String Conversion with No JSON?

How do you Convert PHP String to JavaScript String?

How do you Post a JavaScript Array to a PHP Array?

How do you send a value to PHP using JavaScript?

Info on unwanted primary field auto-sorting

How can I do instant article font size, font family, and paragraph formatting with radio buttons?

How can I create custom HTML tags that are safer for MySQL databases?

How can I edit text from MySQL databases by using a textarea box?

How can I highlight matched search terms in a MySQL database table search?

How can I search using not only exact phrase matching but also a series of words to match in a MySQL database table search?

What's the code for an Ajax and PHP Based Input Filter?

Ajax and PHP Based Insult Auto-Completer

How can I use PHP and MySQL for Checking Key Codes to Allow Update to a New Software App Version?




Personal Status Boards (PSB™)

Standard Free PSB

PSB Pro Version

Social PSB

Social PSB Plus (with Email)

Business PSB

Business PSB Plus (with Email)

PSB demo

Social PSB demo

Business PSB demo

So what's all this PSB stuff about?

Chart comparing business status boards

PSB hosting diagram

PSB Licence Agreement




Article Content Management System

Content Management System Introduction

Content Management System—Article Navigation

Content Management System—Article Indexing

Content Management System—Article Editing

Content Management System—Article Searching

Content Management System—Article Deleting

Content Management System—Article Writing

Content Management System—Article Reading

What are the terms of use for our Article Content Management System?




Website Directory Content Management System

Website Directory Navigation

Website Directory—Delete Category

Website Directory—Delete URL

Website Directory—Add URL

Website Directory—Add Category

Website Directory—Directory Creating

Website Directory—View by Category (Demo Code)

Website Directory—View by URL (Demo Code)

Website Directory—View by Category (Demo)

Website Directory—View by URL (Demo)

Website Directory—View

Website Directory—View (Demo)




Photo Gallery Content Management System

Code for Photo Gallery Navigation

Code for Photo Gallery—View

Code for Photo Gallery—Create

Code for Photo Gallery—Add Category

Code for Photo Gallery—Delete Category

Code for Photo Gallery—Add Photo

Code for Photo Gallery—Delete Photo

Code for JavaScript Photo Gallery

JavaScript Photo Gallery




Forum Content Management System

Forum: home page

Forum: search

Forum: login

Forum: topic and replies viewing page

Forum: add topic to database

Forum: add reply to database

Forum: edit topic in database

Forum: create topic in database

Forum: delete topic in database

Forum: delete reply in database

Forum: delete user account in members table



Copyright © 2002 -
MCS Investments, Inc. sitemap

PSBs, social networking, social evolution, microcommunities, personal status boards
PSBs, social networking, business personal status boards
website design, ecommerce solutions
website menus, buttons, image rotators
Ez-Architect, home design software
the magic carpet and the cement wall, children's adventure book
the squirrel valley railroad, model railroad videos, model train dvds
the deep rock railroad, model railroad videos, model train dvds

Regular Expression Email Validator

The source code for the Regular Expression Email Validator is at the bottom of the page. A discussion of what we did precedes the code. Just before that you'll find a link giving you the opportunity to try out the Regular Expression Email Validator. If you use it somewhere on the Net, please give us a dofollow backlink with link text: "Regular Expression Email Validator". Thank you. Below, you'll see a grueling series of test Emails we subjected our Regular Expression Email Validator to, followed by the results. First we will look at Emails that validated, and our comments about the results. Then we will look at Emails that did not validate, and our comments about why these were the correct results. It is probably obvious that with new top domains appearing all the time, we couldn't be expected to use (com|info|biz| etc. . . ) as a hugely long, ever-expanding parenthesis-enclosed set of literals separated by the alternation operator |. Country codes change as well, so we check only for the required 2 letter character match. So one can get plenty of nonexistant Emails validated, but the same is true of URL validators, etc. We check the format, making sure their input seems legitimate. Similarly, no HTML/JavaScript page can actually try out the emails or the URLs to make sure they exist. That would not be doable or practical. Please send us comments about how you like our validator.

Be forewarned that we used many bogus names for things just to keep you on your toes, so mysite, for example, may represent site name or subdomain, according to their format inspection and .com may be many things besides top domain.

THESE EMAILS WILL VALIDATE:
JOEjoe@mysite.com uppercase is fine
JOE.joe.joe.joe@mysite.com usernames with dot-separated words are fine too
www.joe.joe.joe@mysite.com this is okay but the www will NOT be interpreted as the server world wide web
JOEjoe@mysite.com.co final co is country code
JOEjoe@mysite.com.com mysite is seen as subdomain and 1st .com is seen as site name and 2nd .com is seen as top domain
JOEjoe@mysite.com.com.co mysite is seen as subdomain and 1st .com is seen as site name and 2nd .com is seen as top domain and final co is country code
JOEjoe@mysitecom.com.com.co mysitecom is seen as subdomain and 2nd com is seen as site name and 3rd com is seen as top domain and final co is country code
JOE_k.jk-joe@mysite.com - and _ characters are allowed in username section
JOE_k.jk-joe@my-site_.com - and _ characters are allowed in domain section
JOE_k.jk-joe@my-SITE_.com uppercase is fine in domain section
JOE_k.jk-joe@my-SITE_.museum.museum.uk my-SITE_ is seen as subdomain and 1st museum is seen as site name and 2nd museum is a real top domain name, and uk is a real country code



THESE EMAILS WILL NOT VALIDATE BECAUSE:
JOE_k.jk-joemy-SITE_.museum.museum.uk missing @
JOE@joe@mysite.com.com.co 1 too many @s
JOE..joe@mysite.com.com.co 2 dots in a row is incorrect
JOE.joe.@mysite.com.com.co dot before @ is incorrect
.JOE.joe@mysite.com.com.co dot as 1st character is incorrect
JOE.joe@.mysite.com.com.co dot after @ is incorrect
JOE.joe@mysite.com.com.com final com is country code which needs to be 2 characters
JOE.joe@mysite.com.commune.co commune is top domain which must be 2-6 characters, not 7
JOE*joe@mysite.com.com.co only letters, numbers, hyphens, underscores and dots are allowed
JOE.joe@mysite..com.co 2 dots in a row is incorrect
JOE.joe@mysite.mysite.mysite.com.co mysite is okay as subdomain, site name, and top domain (the latter must be 2-6 characters), but then .com before .co needs deleting
JOE.joe@mysite.com.co. dot as last character is incorrect
JOE.joe@mysite!.com.co no ! allowed in url; only letters, numbers, hyphens, underscores and dots are allowed



Just because "mysite" looks like a site name, below, doesn't change the fact that the following validate because the formatting shows that com.com, museum.com, and museum.museum are the domains below, and mysite is in the subdomain position, as formatted. d@subdomain.domain.com.co gives a truer picture, and is formatted similarly to the other URLs. The domain is domain.com, not just domain, with .com as the top domain part.

d@mysite.com.com
d@mysite.com.com.co
d@mysite.museum.com.co
d@mysite.museum.museum
d@mysite.museum.museum.co

d@subdomain.domain.com.co

In the above address, d is the username, subdomain is the subdomain, domain.com is the domain with .com being the top level domain, and co is the country code.

[username][subdomain, like in http://images.google.com][domain, ends with top-level domain like .com][2-digit country code]

There's no way to know that com or biz or info or museum are top level domains instead of site names except by their position in the email formatting. Positioning is what our validation script uses to figure out which they are.

The code below lets you test various emails to check what will or will not validate with the check() function. Note that we did not allow IP addresses for the domain, however legal. In the code, for testing we used: {alert("Email address validated OK.");return false}} but when you actually use the code, change this alert code to simply {return true}}, and add an appropriate action in the form tag.

Now let's look at the regular expression we used:

The ^ says to match right after the start of the string (inputted URL). The [A-Za-z0-9-_]+ means it's necessary that the string being matched contains at least 1 legal character before the @, and it's not okay if it doesn't. The + means there must be one or more of what is enclosed in the character class.

The (\.[A-Za-z0-9-_]+)* section says it is okay to have more characters before the @, with at least one character between dots, and the optional indicated by a *, which means from 0 to many repetitions is okay. The dot is escaped with \ which means we want its literal meaning, not its operator meaning. (As an operator, a dot means "match any character.") Note that alphanumeric characters as well as - and _ are allowed in emails, so we allow them here, but if you're including another set of letters and/or numbers, you must begin it with a period. So the \. is obviously indicating just that. But the + is not as straightforward. The []s are a "character class", also called "character set", with which you can tell the regex engine to match only one out of several characters. So if you're including another set of letters and/or numbers, the bracketed area shows the choices, while the + says there must be 1 or more of these characters. Note this does NOT mean you have to have another set of letters and/or numbers in your input string. It means that IF YOU DO have another set of letters and/or numbers, it must contain 1 or more of the bracketed characters (and, of course, the period).

Next, after the @, comes ([A-Za-z0-9-_]+\.)?, the subdomain section whose character class is identical to the previous section, and they both end with a + sign, meaning it is not optional—you must have at least one of these characters followed by a dot if you use it, since we are now in the optional subdomain part of the domain. The next bunch of code is ([A-Za-z0-9-_]+, the required domain section, with a plus saying you must use one or more characters. The first parenthesis in this domain section has its mate just before the $ at the end of the regular expression. These grouping operators enclose areas by use of an open and close parenthesis and whatever immediately follows the group applies to the group. The dollar sign is the opposite of the ^ sign. The $ means to match right before the end of the string. It is important to have this set of parenthesis because the domain section, then the top domain section, then the optional country code, must all be adjascent and at the end. The next parenthesis set (\.[A-Za-z]{2,6}) forces a period and then a top domain of 2 to 6 letters. The {} brackets mean {min,max}, i.e., the least to the most letter characters that will match the input string's top domain. If they have 0, 1, or more than 6, the match will fail. (The top domains travel and museum both require 6 characters.)

The (\.[A-Za-z]{2})? is the optional country code—hence the question mark. Note it requires a period at the start IF it is used. And it must have 2 characters. Hence the {2}. Finally, we see the close parenthesis that, with its open parenthesis mate, groups the subdomain, the domain, and the country code just before the $ which means to match these groups at the end of the string. The country code is optional—hence the ?. The ?, *, and + are repetition operators. The question mark means 0 or 1 repetitions are okay. The * means 0 or more repetitions are okay. The plus means 1 or more repetitions are okay. Since we used the ? we know that 0 repetitions of a set of 2 letter characters are okay but so is putting one group of them.



Try the Regular Expression Email Validator.

Good info site for learning about Regular Expressions.



<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>Regular Expression Email Validator</TITLE>
<meta name="description" content="Good, Tested, Regular Expression Email Validator">
<meta name="keywords" content="Regular Expression Email Validator,javascript, dhtml, DHTML">

<script language=javascript>

function check(){

var ck_email = /^[A-Za-z0-9-_]+(\.[A-Za-z0-9-_]+)*@([A-Za-z0-9-_]+\.)?([A-Za-z0-9-_]+(\.[A-Za-z]{2,6})(\.[A-Za-z]{2})?)$/;
if(document.form.email.value.search(ck_email)==-1)
{alert("That email address is not valid.");return false}else

{alert("Email address validated OK.");return false}}

</script>
</HEAD>
<body>
<BR><BR><BR><BR>
<form style='margin-left:140px' name='form' action=" " method="POST" onsubmit="return check()">
Avoid "display name" and < > characters. Use this form: <span style='color:blue'>john.smith@example.com</span>.<br>Country codes are okay. Uppercase letters are okay. Use letters, numbers, hyphens, underscores and dots.<br>
<INPUT maxLength="80" type="text" name="email" size="80">
<INPUT TYPE="SUBMIT" value="Submit Email">
<INPUT TYPE="RESET" value="reset">
</form>
</BODY>
</HTML>