如何在golang regexp模式中使用变量

时间:2020-08-05 06:36:21

标签: regex go

如何在golang正则表达式中使用变量作为模式。

wordVar := "demo"

rgx := regexp.MustCompile(`\d+\t(\w+)`) // this work

rgx := regexp.MustCompile(`\d+\t( + wordVar + )`) // this failed

0 个答案:

没有答案
相关问题