Good morning all,
I want to make a regex that match 3 same consecutive numbers. It should match only 3 numbers in a row (separated by a space), the numbers should be identical. If there are less or more than 3 same numbers, then the output should be false
I have tried this regex /.*(\d+) \1 \1(?!(\s\1))/
console.log(/.*(\d+) \1 \1(?!(\s\1))/.test('I am 42 42 4 hey yoo')); //false --> Correct
console.log(/.*(\d+) \1 \1(?!(\s\1))/.test('I am 42 42 42 hey yoo')); //true --> Correct
console.log(/.*(\d+) \1 \1(?!(\s\1))/.test('I am 42 42 42 4 hey yoo')); //true --> Correct
console.log(/.*(\d+) \1 \1(?!(\s\1))/.test('I am 42 42 42 42 hey yoo')); //true --> this output should be false since there are 4 same consecutive digits
Any advice, please?