I don’t want to repeat repeat myself
Yesterday at work, a customer spotted a typo in our UI: “you can use the use the Tailscale CLI”. After the typo was fixed, I wanted to find other cases of accidentally repeated words or phrases. I used two regular expressions to search every codebase for unnecessary repetition.
The first regex finds repeated words:
\b([A-Za-z]+) \1\b
Backfill product data from from Stripe
Learn more about about inviting users
Argument must be be one of host name, IP set name, IP prefix, or IP
There’s a capturing group for a single word made up of letters ([A-Za-z]+), a space, then a backreference to the group.
That expression is surrounded by word boundary assertions \b, which check that I’m at the start/end of a word – this avoids finding repeated character sequyences that within longer words, like “with the reason”.
The second regex finds repeated phrases:
\b([A-Za-z]+ [A-Za-z]+) \1\b
Follow the steps in the in the "How to" section
Log in to in to your account
To configure federated identities federated identities using the Go SDKI’ve changed the capturing group, so now it looks for two words separated by a space.
Sometimes repetition is useful, like when I really really went to emphasise a point, but often it’s just a typo. Cleaning up these mistakes has been a fun Friday cleanup task.