Clean string from html content

There is a string, for instance

s := "<b>John</b> Thank you."

What is the best way to clean the string from



For Python there is the broadly used Beautiful Soup.

For Go there is a port of this called soup. The method Text is what you are looking for.

I’m I understood you right that you supposed to get content of <b> tag? But what I want to get in result is to convert the source string into:

Thank you.

Hi @cinematik
Please, check this regular expression

package main

import (

const sample = <b>John</b>Thank you.<b>delete this</b>

func main() {
var re = regexp.MustCompile(<(b|B)>\b(([^<])*|(<[^b])*|(<b[^>])*)\b<\/(b|B)>)
s := re.ReplaceAllString(sample, ``)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.