I'm wanting to match ^(@|\s)*{{string}}:?
whereas {{string}} is dynamically defined. It may have periods and dashes and any number of things in it and I really need for it to be escaped.
我想匹配^(@ | \ s)* {{string}} :?而{{string}}是动态定义的。它可能有周期和破折号以及其中的任何数量,我真的需要它才能被转义。
PHP provides a preg_quote
method that escapes all special characters safely. I was wondering if Go provides any sort of analog.
PHP提供了一个preg_quote方法,可以安全地转义所有特殊字符。我想知道Go是否提供任何类型的模拟。