Вы можете использовать это:
/^\S*\.\S*$/
Это работает так:
^ <-- Starts with
\S <-- Any character but white spaces (notice the upper case) (same as [^ \t\r\n])
* <-- Repeated but not mandatory
\. <-- A period
\S <-- Any character but white spaces
* <-- Repeated but not mandatory
$ <-- Ends here
Вы можете заменить \S
на [^ ]
, чтобы работать строго с пробелами (не с табуляциейи др.)