Strugling with regex "exact amount of char" matching

Strugling with regex "exact amount of char" matching


I’ve a couple strings, which should output different values on matching

5555555555 ----> true
27576227382 ----> false

But i’m struggling of how to get it done, since all of the above codes will return true:

/\d{10, }/

Honestly I don’t really know what to test now, since I’ve already tested a lot of stuff in different regex testers, but I dont get it.


Can you be more specific about what should return true? Are you saying the only string which should return true is 10 consecutive 5’s? or 10 digits which are the same?


10 consecutive numbers , if there are less than 10 consecutive numbers, or more than 10 consecutive numbers, it should return false .


If the entire string can only be 10 digits exactly, then the following will do it:



thanks, now that u mention it I finally remember how it worked, that was it!