How can I find repeated letters with a Perl regex?

后端 未结 11 1320
孤独总比滥情好
孤独总比滥情好 2020-12-09 03:18

I am looking for a regex that will find repeating letters. So any letter twice or more, for example:

booooooot or abbott

I won\'t know the

11条回答
  •  醉话见心
    2020-12-09 03:44

    The following code will return all the characters, that repeat two or more times:

    my $str = "SSSannnkaaarsss";
    
    print $str =~ /(\w)\1+/g;
    

提交回复
热议问题