regex - How to write a Regexp for any character, but it must be the same a specific number of times -


i want find strings same character multiple times in row. these can character (including null char), cannot specify character is, occurs 20 or more times in row.

the dot "." matches character, how specify in regexp, must same character if don't know beforehand?

example: bla bla blub oooooooooooooooooo must in xxxxxxxxxxxxxxxxx string.

i want find o-s , x-s lines. ".{10,}" matches line.

you can capture letter , use back-reference 9 times check if same letter repeated 10 times:

/([a-za-z])\1{9,}/g 

regex demo

ps: check of character use:

/(.)\1{9,}/g 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -