I am trying to build a regex that must contain letters only and one dot.
There is a restriction: the dot cannot be placed in beginning or the end.
Example:
abc.difference
I tried to use
^[a-zA-z]*(\d*\.\d*)[a-zA-z]*$
f the dot can go missing in the input string, you can use
/^[A-Za-z]+(?:\.[A-Za-z]+)?$/
If the dot is obligatory:
/^[A-Za-z]+\.[A-Za-z]+$/
Details:
^ - start of string[A-Za-z]+ - one or more letter chars(?:\.[A-Za-z]+)? - an optional occurrence of
\. - a dot[A-Za-z]+ - one or more alpha chars$ - end of string.