Use better Regex to strip down html
This commit is contained in:
parent
2b38638d84
commit
47ee0334db
1 changed files with 7 additions and 1 deletions
|
@ -25,5 +25,11 @@ export function getFormattedMeetingId(videoCallData: VideoCallData): string {
|
|||
}
|
||||
|
||||
export function stripHtml(html: string): string {
|
||||
return html.replace("<br />", "\n").replace(/<[^>]+>/g, "");
|
||||
const aMailToRegExp = /<a[\s\w="_:#;]*href="mailto:([^<>"]*)"[\s\w="_:#;]*>([^<>]*)<\/a>/g;
|
||||
const aLinkRegExp = /<a[\s\w="_:#;]*href="([^<>"]*)"[\s\w="_:#;]*>([^<>]*)<\/a>/g;
|
||||
return html
|
||||
.replace(/<br\s?\/>/g, "\n")
|
||||
.replace(aMailToRegExp, "$1")
|
||||
.replace(aLinkRegExp, "$2: $1")
|
||||
.replace(/<[^>]+>/g, "");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue