--
ab--c
-
abc-
^(?!-)(?!.*--)[A-Za-z0-9-]+(?
Explanation:
^ # Anchor at start of string (?!-) # Assert that the first character isn't a - (?!.*--) # Assert that there are no -- present anywhere [A-Za-z0-9-]+ # Match one or more allowed characters (?