为什么C:\\\\(引用`)正则   表达式   不匹配"C:\\"而且"C:\\\\"做什么?
r, err := regexp.Compile(`C:\\\\`) // Not match
r, err := regexp.Compile("C:\\\\")  // Matches
if r.MatchString("Working on drive C:\\") == true {
    fmt.Printf("Matches.") 
} else {
    fmt.Printf("No match.")
}
原始字符串文字中的转义序列(引用引号)不会被解释.
`C:\\\\`
相当于:
"C:\\\\\\\\"
请参阅Go编程语言规范 - 字符串文字.
| 归档时间: | 
 | 
| 查看次数: | 156 次 | 
| 最近记录: |