Removes HTML tags from a string and trims surrounding whitespace.
Uses the same regex the legacy audit-chart edge function used, so callers
that depend on legacy parity (e.g. the session-note validation context fed
to the AI) produce byte-identical text. This is a plain-text extractor, NOT
a sanitizer — it does not decode HTML entities or guard against malicious
markup. Use a real sanitizer (e.g. dompurify) when rendering untrusted HTML.
Removes HTML tags from a string and trims surrounding whitespace.
Uses the same regex the legacy
audit-chartedge function used, so callers that depend on legacy parity (e.g. the session-note validation context fed to the AI) produce byte-identical text. This is a plain-text extractor, NOT a sanitizer — it does not decode HTML entities or guard against malicious markup. Use a real sanitizer (e.g. dompurify) when rendering untrusted HTML.