-1

Code example:

func main() {
    regx:= `
[^`]
 `
}
./main.go:9:4: syntax error: unexpected ] at end of statement
./main.go:10:1: string not terminated

How to solve back quotes nested back quotes?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
  • 1
    You don't https://github.com/golang/go/issues/24475 maybe `regx := "\n[^\`]\n"` will do the trick though https://go.dev/play/p/_ZGCAv8HdwY – Zyigh Dec 29 '21 at 09:44
  • 2
    please see https://stackoverflow.com/questions/21198980/how-to-escape-back-ticks – blackgreen Dec 29 '21 at 09:46

1 Answers1

0

I see what you want but we cannot escape backticks inside backticks. However, you can do something like the following.

    regx := `
[^` + "`" + `]
`