Validation to check UserID with Period/Dot seperated

Regular Expression Rules:

Finite automata rule, Values should precede with characters of set [A-Za-z] and followed with period(.) and character set [A-Za-z]

Regular Expression:

^[a-zA-Z]+(\.[a-zA-Z]+)+$


Matches



1) Ratan.Tata
2) Anil.Dhiru.Ambhani

Non-Matches



Ratan.
1) .Mukesh.
2) Amir.khan.

Regular Expression Logic in Javasctipt


 

function CheckForPeriodSeperatedUserID( fieldValue )
{
var regex = /^[a-zA-Z]+(\.[a-zA-Z]+)+$/;
if( !fieldValue.match( regex ) )
{
alert('The UserID is not desired format,XXX.YYYY XXX.YYYY.ZZZZ');
return false;
}
return true;
}


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: