MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / extractFirstMatch

Function extractFirstMatch

sdk/src/tools/read-url.ts:115–119  ·  view source on GitHub ↗
(html: string, pattern: RegExp)

Source from the content-addressed store, hash-verified

113}
114
115function extractFirstMatch(html: string, pattern: RegExp): string | undefined {
116 const match = html.match(pattern)
117 if (!match?.[1]) return undefined
118 return normalizeText(decodeHtmlEntities(stripTags(match[1])))
119}
120
121function stripTags(html: string): string {
122 return html.replace(/<[^>]*>/g, ' ')

Callers 1

extractHtmlFunction · 0.85

Calls 3

normalizeTextFunction · 0.85
decodeHtmlEntitiesFunction · 0.85
stripTagsFunction · 0.85

Tested by

no test coverage detected