[Solved] Why doesn't the following Regular Expression detect '.'? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

[Solved] Why doesn't the following Regular Expression detect '.'?

I am trying to validate email input using the REGEX as follows: /^[a-z][a-z0-9]+@[a-z]\./ For some reason i have issues with detecting the dot in the string..Can anyone help me with the correction. i know it's quite basic REGEX but i'm still practicing REGEX..

16th Mar 2020, 7:48 AM
$hardul B
$hardul B - avatar
4 Answers
+ 6
$hardul B after \. [a-z]{2,3}$ this was missing. It is necessary to put because we write com, in, co after dot (.) and also here the size of String maybe be 2-4 after dot(.) so we need to use {2,4}. Here $ used to match the String
16th Mar 2020, 8:41 AM
A͢J
A͢J - avatar
+ 4
Brief description is given here. Might be it can help to understand https://www.google.com/amp/zparacha.com/validate-email-address-using-javascript-regular-expression/amp
16th Mar 2020, 7:54 AM
A͢J
A͢J - avatar
+ 3
AJ Anant Thank you.. It works.. But can you guide me with the mistake in my REGEX ..
16th Mar 2020, 8:19 AM
$hardul B
$hardul B - avatar
+ 3
AJ Anant Just a correction $ is for end of the string! 👍 Thanks!
16th Mar 2020, 9:09 AM
$hardul B
$hardul B - avatar