我有一個在 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為什么會這樣?
Go中的正則表達式不匹配
慕無忌1623718
2022-06-27 10:37:44