Menu

Post image 1
Post image 2
1 / 2
0

Why your `[^<]+` regex is silently breaking on React SSR output

DEV Community·GasPriceCheck·about 1 month ago
#sDdGEMxu
Reading 0:00
15s threshold

Picture this. You've shipped a programmatic SEO site, a few thousand pages of templated content. Google flags 14 URLs as soft 404s. You write a quick diagnostic: hit each URL, fetch the SSR HTML, check for a few content markers (a price string, a state average, a section header). Confirm what's really rendering, fix what's missing, move on. That was the plan. Forty minutes in, my script told me 0 of 14 pages had any EIA price data rendered. None. I was about to dig into the data fetching layer when something nagged at me. I curled one of the URLs by hand. The price was right there in the HTML. Plain text, easy to spot. The script was lying. The regex was lying. It took me longer than I want to admit to figure out what was happening, so here's the writeup so you don't burn the same hour. The regex that "worked" The diagnostic was straightforward. For each ZIP code page, I wanted to detect whether the EIA state average price was rendered in the SSR HTML.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More