匹配没有扩展名的文件名的正则表达式

A regex to match a filename that DOESN'T have an extension

我正在寻找一个仅在文件名中没有扩展名时才会匹配的正则表达式。

test.doc = 不匹配
testaaa = 比赛

我肯定能找到“.”和 /。但我怎么能否定呢?我尝试使用 (?!.) 但我在文件名的每个字符上都匹配。

谢谢

我会检查文件中没有任何带 ^[^.]*$:

的点

var patt = new RegExp("^[^.]*$");

console.log(patt.test('test.doc'));
console.log(patt.test('testaaa'));