Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A smaller two step regex provides good results</p> <p>/** check to see if email address is in a valid format. * Leading character of mailbox must be alpha<br> * remaining characters alphanumeric plus -_ and dot<br> * domain base must be at least 2 characters<br> * domain extension must be at least 2, not more than 4 alpha<br> * Subdomains are permitted. * @version 050208 added apostrophe as valid char * @version 04/25/07 single letter email address and single <br> * letter domain names are permitted. */ public static boolean isValidEmailAddress(String address){ String sRegExp; </p> <pre><code> // 050208 using the literal that was actually in place // 050719 tweaked // 050907 tweaked, for spaces next to @ sign, two letter email left of @ ok // 042507 changed to allow single letter email addresses and single letter domain names // 080612 added trap and unit test for two adjacent @signs sRegExp = "[a-z0-9#$%&amp;]" // don't lead with dot + "[a-z0-9#$%&amp;'\\.\\-_]*" // more stuff dots OK + "@[^\\.\\s@]" // no dots or space or another @ sign next to @ sign + "[a-z0-9_\\.\\-_]*" // may or may not have more character + "\\.[a-z]{2,4}"; // ending with top level domain: com,. biz, .de, etc. boolean bTestOne = java.util.regex.Pattern.compile( sRegExp, java.util.regex.Pattern.CASE_INSENSITIVE).matcher(address).matches(); // should this work ? boolean bTwoDots = java.util.regex.Pattern.compile("\\.\\.", // no adjacent dots java.util.regex.Pattern.CASE_INSENSITIVE).matcher(address).find(); boolean bDotBefore = java.util.regex.Pattern.compile("[\\.\\s]@", //no dots or spaces before @ java.util.regex.Pattern.CASE_INSENSITIVE).matcher(address).find(); return bTestOne &amp;&amp; !bTwoDots &amp;&amp; !bDotBefore; } // end IsValidEmail </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload