The FindString or FindAllString functions are the simplest ways to find the matching pattern in the given string. The only difference is that the FindString method of Regexp will return only the first occurrence. On the other hand, the FindAllString, as the name suggests, returns a slice of strings with all occurrences.
The Regexp type offers a rich set of FindXXX methods. This recipe describes only the String variations that are usually most useful. Note that the preceding code uses the MustCompile function of the regexp package, which panics if the compilation of the regular expression fails.