Regex for [a-zA-Z0-9\-] with dashes allowed in between but not at the start or end

前端 未结 4 1361

Update:

This question was an epic failure, but here\'s the working solution. It\'s based on Gumbo\'s answer (Gumbo\'s was close to working so I chose it as the accepte

4条回答
  •  旧巷少年郎
    2021-02-14 12:57

    If you simply don't want a dash at the end and beginning, try ^[^-].*?[^-]$

    Edit: Bah, you keep changing it.

提交回复
热议问题