How to match a regex with backreference in Go?

前端 未结 4 1809
北恋
北恋 2020-11-29 09:27

I need to match a regex that uses backreferences (e.g. \\1) in my Go code.

That\'s not so easy because in Go, the official regexp package uses the RE2 engine, one th

4条回答
  •  执笔经年
    2020-11-29 10:13

    Answering my own question here, I solved this using golang-pkg-pcre, it uses libpcre++, perl regexes that do support backreferences. The API is not the same.

提交回复
热议问题