How to match recurring strings with regular expression - javascript - regex
迷茫
迷茫 2017-06-19 09:06:59
0
2
834

For exampleaaabccc11fdsaThis string, I want to match strings like aaa, ccc and 11 that will be repeated more than twice. What should I do? If regular expressions can't do it, are there any other PHP or Python built-in functions that can do it? If there are no built-in functions, can we only write the algorithm by hand?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
学习ing

You can match it with a simple regular expression. I only know js.

var s = 'aaabccc11fdsa';
var reg = /(\w)+/ig;

console.log(s.match(reg)); //["aaa", "ccc", "11"]
洪涛

JS code:

var s = 'aaabccc11fdsa';
var re = /.{2,}/g;

console.log(s.match(re));

Among them, . in the regular expression means any character {2,} means matching twice or more.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template