代碼:html
//File: main.go package main import ( "fmt" "regexp" ) func main() { r := regexp.MustCompile(`(?i)a`) s := "abAacde" v := r.FindAllString(s, -1) fmt.Println((v)) }
輸出:[a A a]正則表達式
若是不熟悉正則表達式的語法的話,能夠執行下面命令:spa
go doc regexp/syntax
聽說是出於效率的考量,go不支持環視(或叫零寬斷言、預搜索)。.net
參考:3d
http://www.cnblogs.com/golove/p/3269099.htmlcode
https://www.jianshu.com/p/3c3d22f4aea7regexp
關於環視可參考:htm
https://blog.csdn.net/lxcnn/article/details/4304754blog
一併致謝!class