const x = /^[0-9]+-[0-9]+$/; x.test('123-'); // true, should be false x.test('123-4556-45645-24'); // false, should be true
I suck at regex, so don't know what I need to change in order for it to work!, a valid pattern is {number}-{number}... .