Tuesday, August 7, 2018

Regular Expression for Email Validation

Regular Expression Pattern

Sample Regex Example:- /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

Find each character attribute information of above expression below.

CharacterDescription
/ .. /All regular expressions start and end with forward slashes.
^Matches the beginning of the string or line.
\w+Matches one or more word characters including the underscore. Equivalent to [A-Za-z0-9_].
[\.-]\ Indicates that the next character is special and not to be interpreted literally.
.- matches character . or -.
?Matches the previous character 0 or 1 time. Here previous character is [.-].
\w+Matches 1 or more word characters including the underscore. Equivalent to [A-Za-z0-9_].
*Matches the previous character 0 or more times.
([.-]?\w+)*Matches 0 or more occurrences of [.-]?\w+.
\w+([.-]?\w+)*The sub-expression \w+([.-]?\w+)* is used to match the username in the email. It begins with at least one or more word characters including the underscore, equivalent to [A-Za-z0-9_]. , followed by . or - and . or - must follow by a word character (A-Za-z0-9_).
@It matches only @ character.
\w+([.-]?\w+)*It matches the domain name with the same pattern of user name described above..
\.\w{2,3}It matches a . followed by two or three word characters, e.g., .edu, .org, .com, .uk, .us, .co etc.
+The + sign specifies that the above sub-expression shall occur one or more times, e.g., .com, .co.us, .edu.uk etc.
$Matches the end of the string or line.



Note: If you want to work on 4 digit domain, for example, .info or .edxu  or .tiff  then you must change w{2,3} to w{2,4}.

Tips of Google

Useful Tips of Google :

http://www.google.com/maps/timeline 
- you will see all the places you visited day-wise.

http://myactivity.google.com/myactivity  
- will show you all the voice queries you made to Google Assistant, the time of opening the apps, your activity in the Google Play store.

http://adssettings.google.com/authenticated  
- shows the ads personalized by Google based on your online behavior

http://myaccount.google.com/permissions  
- you can see all your apps and what permissions they require and have been granted by you

http://takeout.google.com/settings/takeout  
- you can prepare and download the archive of your data including photos, videos, and other media

Regular Expression for Email Validation

Regular Expression Pattern Sample Regex Example:- /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/ Find each character attribute inform...