How do I write a regex which can accept both lowercase and uppercase alphabets with numbers and ‘-‘, but not allowing expressions to start and end with ‘-‘
I have tried the below solution but it does not allow anything to be added,
/^(?!-)(?!.–)[A-Za-z0-9-](?<!-)$/
New contributor
1DT19CS002 YUSUFKHAN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.