I would like to test if user type only alphanumeric value or one \"-\".
hello-world -> Match hello-first-world -> match this-
Here you go (this works).
var regExp = /^[A-Za-z0-9]+([-]{1}[A-Za-z0-9]+)+$/;
letters and numbers greedy, single dash, repeat this combination, end with letters and numbers.