关于golang正则引擎的反向引用
我表达跟后向引用有关,就是后向预查,况且你这也不是后向引用,你只是在正则匹配后,从缓冲区取,我说的后向引用是下面这种情况,golang没法匹配。
enNodeRx := regexp.MustCompile(`<(p|h[0-9]|ul|ol)[^>]*class=['"]?en['"]?[^>]*>.*</$1>`)
s := `<p class="en">Because these channels use the network, there is alwasy the possibility of network errors leading to timeouts. Andrew Gerrand points out a solution using <a href="http://blog.golang.org/2010/09/go-concurrency-patterns-timing-out-and.html">timeouts</a>: "[Set up a timeout channel.] We can then use a select statement to receive from either ch or timeout. If nothing arrives on ch after one second, the timeout case is selected and the attempt to read from ch is abandoned."</p>`
matched := enNodeRx.Find([]byte(s))
fmt.Println(string(matched))