📅  最后修改于: 2022-03-11 14:55:16.445000             🧑  作者: Mango
You can do this
/^[^-]+-[^-]+$/
^ depicts the start of the string
$ depicts the end of the string
[^-]+ matches 1 to many characters except -