const pattern = /^access\/\d+$/ pattern.test('access/1') // true pattern.test('access/2') // true pattern.test('access/3') // true pattern.test('blabla/bla') // false