标签: regex grouping
有人可以给我一个正则表达式,用相同的字符对字符串进行分组吗?
示例:
For "111222333" ---> "111", "222", "333" For "122111" ---> "1", "22", "111" For "121" ---> "1", "2", "1"
答案 0 :(得分:0)
你可以试试这个:
(.)\1*
LIVE DEMO