Magicks M
2018-11-20 22:16:58 UTC
Hi, I'm having some trouble with this.
I want to capture seqences on identical characters in a string: "aaabbbcccd"
-> "aaa" "bbb" "ccc" "d"
I attempted to use the regular pattern "((.)%1*)" and found that
quantifiers didn't work. I then switched to lpeg and attempted to use:
Cg(P(1), "char") * Cb'char'^0
Which errors, and thus I cannot think of a good way to match this.
I want to capture seqences on identical characters in a string: "aaabbbcccd"
-> "aaa" "bbb" "ccc" "d"
I attempted to use the regular pattern "((.)%1*)" and found that
quantifiers didn't work. I then switched to lpeg and attempted to use:
Cg(P(1), "char") * Cb'char'^0
Which errors, and thus I cannot think of a good way to match this.