2Fast4YouBR 2Fast4YouBR - 1 year ago 193
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
Answer Source

You can add lookahead for the same. See demo.



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download