I am unable to do a validation for string sometext.sometext.sometext.sometext.sometext….
I have tried with this regular expression ^[\w]*.{1,}[\w]$ matches the above string but if i give more than one dots consecutively inbetween the text for eg. sometext.sometext…..sometext above regular expression matches this also.
Any help is appreciated.
Thanks in advance.
{1,} means that there is at least one occurence. If you want exactly one occurence, just use the character as is. Also, you need to escape the dot in your regex, since it stands for “any character” if you don’t.
The following should work if you want to allow 1-n non-empty string parts separated by dots: