News for hackers. Stuff that matters.
Re:Claude Code's source code has been leaked via a map file ... by lou1306 on Tuesday March 31, 2026 @07:02AM (#47585556)
They're searching for multiple substrings in a single pass, regexes are the optimal solution for that.
Re:Claude Code's source code has been leaked via a map file ... by noosphr on Tuesday March 31, 2026 @07:09AM (#47585616)
The issue isn't that regex are a solution to find a substring. The issue is that you shouldn't be looking for substrings in the first place.

This has buttbuttin energy. Welcome to the 80s I guess.

Re:Claude Code's source code has been leaked via a map file ... by 8cvor6j844qw_d6 on Tuesday March 31, 2026 @07:37AM (#47585858)
Very likely vibe coded.

I've seen Claude Code went with a regex approach for a similar sentiment-related task.

Re:Claude Code's source code has been leaked via a map file ... by mr_00ff00 on Tuesday March 31, 2026 @11:34AM (#47588905)
My understanding of vibe coding is when someone doesn’t look at the code and just uses prompts until the app “looks and acts” correct.

I doubt you are making regex and not looking at it, even if it was AI generated.

Re:Claude Code's source code has been leaked via a map file ... by rdiddly on Tuesday March 31, 2026 @10:44AM (#47588102)
Clbuttic!
Re:Claude Code's source code has been leaked via a map file ... by lou1306 on Tuesday March 31, 2026 @12:20PM (#47589708)
> The issue is that you shouldn't be looking for substrings in the first place.

Why? They clearly just want to log conversations that are likely to display extreme user frustration with minimal overhead. They could do a full-blown NLP-driven sentiment analysis on every prompt but I reckon it would not be as cost-effective as this.

Re:Claude Code's source code has been leaked via a map file ... by noosphr on Tuesday March 31, 2026 @04:14PM (#47592830)
>Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.

The only time to use a regex is when searching with a human in the loop. All other uses are better handled some other way.

>They could do a full-blown NLP-driven sentiment analysis on every prompt but I reckon it would not be as cost-effective as this.

Every conversation is sent to an llm at least a thousand times the size of gpt2 which could one shot this nearly a decade ago.

Re:Claude Code's source code has been leaked via a map file ... by lou1306 on Wednesday April 01, 2026 @02:58AM (#47597758)
> Every conversation is sent to an llm at least a thousand times the size of gpt2 which could one shot this nearly a decade ago.

Yes, but that is _what the product does_. What we are talking about is _telemetry_.

Re:Claude Code's source code has been leaked via a map file ... by BoppreH on Tuesday March 31, 2026 @07:10AM (#47585626)
It's fast, but it'll miss a ton of cases. This feels like it would be better served by a prompt instruction, or an additional tiny neural network.

And some of the entries are too short and will create false positives. It'll match the word "offset" ("ffs"), for example. EDIT: no it won't, I missed the \b. Still sounds weird to me.

Re:Claude Code's source code has been leaked via a map file ... by hk__2 on Tuesday March 31, 2026 @07:16AM (#47585687)
It’s fast and it matches 80% of the cases. There’s no point in overengineering it.
Re:Claude Code's source code has been leaked via a map file ... by NitpickLawyer on Tuesday March 31, 2026 @10:49AM (#47588185)
> There’s no point in overengineering it.

I swear this whole thread about regexes is just fake rage at something, and I bet it'd be reversed had they used something heavier (omg, look they're using an LLM call where a simple regex would have worked, lul)...

Re:Claude Code's source code has been leaked via a map file ... by vharuck on Tuesday March 31, 2026 @07:18AM (#47585713)
The pattern only matches if both ends are word boundaries. So "diffs" won't match, but "Oh, ffs!" will. It's also why they had to use the pattern "shit(ty|tiest)" instead of just "shit".
Re:Claude Code's source code has been leaked via a map file ... by BoppreH on Tuesday March 31, 2026 @07:21AM (#47585737)
You're right, I missed the \b's. Thanks for the correction.