You can use this:
/^\S*\.\S*$/
It works as follows:
^ <-- 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
You can replace \S with [^ ] to work strictly with spaces (not with tabs, etc.)
source share