preg_replace_callback

preg_replace_callback

[code=golang]
re := regexp.MustCompile(`(<p(.*?)>)`)

fmt.Println(re.ReplaceAllStringFunc("<p class='one'>sometime<p>something</p>some code</p>", func(s string) string {
	return ""
}))
[/code]