In this way, I got every time invalid, basically, I have a need to pass the dynamic length of the number and check is it valid or not.
var len=8; var pattern