Skip to main content

Regex to validate characters and numbers concatenated with -

I'm trying to match a string that Characters and numbers cannot be concatenated, if you want to concatenate use a hyphen.

For example, these should all match:

  • abc-123-123-***
  • 123-abc-abc-***
  • 123-abc-123-***
  • abc-123-abc-***
  • abc-efg-***

not match:

  • abc123
  • 123abc
  • abc1
  • a1b2 Please help me to find a javascript regex.

Please help me to find a javascript regex.

Via Active questions tagged javascript - Stack Overflow https://ift.tt/YcnQmzt

Comments