惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Engineering at Meta
Engineering at Meta
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
小众软件
小众软件
GbyAI
GbyAI
J
Java Code Geeks
B
Blog
Blog — PlanetScale
Blog — PlanetScale
宝玉的分享
宝玉的分享
M
MIT News - Artificial intelligence
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
阮一峰的网络日志
阮一峰的网络日志
NISL@THU
NISL@THU
T
Tenable Blog
S
Schneier on Security
T
Tor Project blog
V
V2EX
S
Secure Thoughts
P
Privacy International News Feed
Spread Privacy
Spread Privacy
博客园 - 三生石上(FineUI控件)
博客园_首页
T
Threatpost
月光博客
月光博客
Know Your Adversary
Know Your Adversary
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss
H
Help Net Security
The Hacker News
The Hacker News
A
Arctic Wolf
B
Blog RSS Feed
雷峰网
雷峰网
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
博客园 - 【当耐特】
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
P
Palo Alto Networks Blog
Attack and Defense Labs
Attack and Defense Labs
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Securelist
L
LangChain Blog
I
InfoQ

alexwlchan

Preventing line breaks in <code> elements Fixing a bug with byte order marks A Git hook to prevent committing directly to main Describing all my photos Rebuilding the computer room What can wonky APIs tell us about the web? Using the Screen Capture API to record a browser window Using Pytester to test my Playwright fixtures Rendering a chat thread in CSS and JavaScript Waiting for website changes in the browser Watching for file changes on macOS Using Playwright to test my static sites Building a basic cache with SQLite HTTP GET requests with the Python standard library Auditing my local Python packages Quietly quantum-resistant blogging Creating a personalised bin calendar Monki Gras 2026 “Prepping Craft” The selfish case for public libraries Dreaming of a ten-year computer Gumdrop, a silly app for messing with my webcam The bare minimum for syncing Git repos Creating Caddyfiles with Cog Swapping gems for tiles Parody posters for made-up movies The Good, the Bad, and the Gutters Using perceptual distance to create better headers The passwords I actually memorise Where I store my multi-factor recovery codes Quick-and-dirty print debugging in Go My favourite books from 2025 Drawing Truchet tiles in SVG Adding a README to S3 buckets with Terraform The palm tree that led to Palmyra
I don’t want to repeat repeat myself
2026-07-03 · via alexwlchan

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. I used [A-Za-z] rather than the word metacharacter \w because I didn’t want to include numbers, which would dramatically increase the number of matches in a codebase. This skips repetitions which include accented characters, but that’s fine because those are rare in my writing.

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 sequences 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 SDK

I’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 want to emphasise a point, but often it’s just a typo. Cleaning up these mistakes has been a fun Friday cleanup task.