标签:keyword cell split javascrip 字符 mat str java space
\1 等于 (\w)
var s = ‘aaabbbcccaaabbbaaabbbbbbbbbb‘ ; var a = s.split( ‘‘ ); a.sort(); s = a.join( ‘‘ ); var pattern = /(\w)\1*/g; var ans = s.match(pattern); ans.sort( function (a, b) { return a.length < b.length; });; console.log(ans[0][0] + ‘: ‘ + ans[0].length);
|
标签:keyword cell split javascrip 字符 mat str java space
原文地址:https://www.cnblogs.com/chiangyibo/p/9501813.html