我有一个在 Go 中不匹配的正则表达式。
但是在正则表达式游乐场中,它匹配得很好:https ://regex101.com/r/VNDXcQ/2 。
它匹配 JS 注释。
这是代码:
comment := "// fallback response. For more information contact support"
re := regexp.MustCompile(`/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm`)
matches := re.MatchString(comment)
fmt.Println(matches) // false
为什么会这样?
 慕无忌1623718
慕无忌1623718 
					Helenr
 随时随地看视频慕课网APP
随时随地看视频慕课网APP
相关分类