Skip to content

refactor: deduplicate regex patterns into util/regex.go#35

Merged
dacharyc merged 1 commit intoagent-ecosystem:mainfrom
x3c3:refactor/deduplicate-regex
Mar 20, 2026
Merged

refactor: deduplicate regex patterns into util/regex.go#35
dacharyc merged 1 commit intoagent-ecosystem:mainfrom
x3c3:refactor/deduplicate-regex

Conversation

@philoserf
Copy link
Contributor

Summary

  • Extract shared CodeBlockStrip, InlineCodeStrip, and CodeBlockPattern regexes into util/regex.go
  • Fixes tilde-fence stripping in content analysis
  • Adds comprehensive tests for the shared patterns

Test plan

  • New tests for backtick and tilde fence patterns
  • Existing tests unchanged and passing

🤖 Generated with Claude Code

Both content/ and links/ defined codeBlockStrip and inlineCodeStrip
independently. The content version only handled backtick fences; the
links version handled both backticks and tildes. Shared patterns now
live in util/ using the more complete tilde-aware version.

This is also a correctness fix: content analysis previously did not
strip tilde-fenced code blocks, inflating word and sentence counts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Member

@dacharyc dacharyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome - thank you for the PR and the bug fix!

@dacharyc dacharyc merged commit f304631 into agent-ecosystem:main Mar 20, 2026
2 checks passed
@philoserf philoserf deleted the refactor/deduplicate-regex branch March 20, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants