Answers for "Regex to match any character being repeated more than 10 times"

C
0

Regex to match any character being repeated more than 10 times

#!perl
use warnings;
use strict;
my $regex = qr/(.)1{9,}/;
print "NO" if "abcdefghijklmno" =~ $regex;
print "YES" if "------------------------" =~ $regex;
print "YES" if "========================" =~ $regex;

#Although the above test script is in Perl, 
#this is very standard regex syntax and should work in any language. 
#In some variants you might need to use more backslashes, 
#e.g. Emacs would make you write (.)1{9,} here.
Posted by: Guest on January-25-2022

Code answers related to "Regex to match any character being repeated more than 10 times"

Code answers related to "C"

Browse Popular Code Answers by Language