2Fast4YouBR 2Fast4YouBR - 6 months ago 42
C# Question

Regex number pattern in a fixed length

I need to validate a field with a fixed length of 8 and it only accept numbers, like '12345678' or '11111118' (these are valid).

But I cannot accept when all numbers are the same, like '11111111'

I came with

https://regex101.com/r/tH2hB7/1 , but I canĀ“t find the corret pattern to identify the repeating numbers

vks vks

You can add lookahead for the same. See demo.