Collapse repeated characters (possibly using regex) #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The program
prints
I suggest you include a list of regexes to match cases such as this.
An alternative would be to collapse all repeated characters before matching, although this would have an issue with any profanities that contain repeated characters that are no longer profane once collapsed.
Completely agree with you on this. Tackling this is already in the list of TODOs on the README:
I think one of the solutions could be to only allow specific characters to be repeated twice, such as
o(e.g.poop) andt(e.g. letter), but collapse letters that aren't usually repeated into a single letter, like i (e.g.shiit) or u (e.g.fuuck).I'm not sure regex is the best solution for this either, because Golang's Regex is known for not being the fastest, but it would be good to check what the performance difference is between multiple
strings.Replace(...)and a single regex.Anyways, thanks for creating an issue for this.
I can't promise when I'll be able to tackle the issue, but if you want to give it a try, you're welcome to :)