The regexp package in the Go standard library provides a deeper level of search by using regular expressions. This defines a syntax that allows you to search for strings in more complex terms, as well as retrieving strings from a document. By using capture groups in regular expressions, you can extract data matching a query from the web page. Here are a few useful tasks that the regexp package can help you achieve.
Searching using the regexp package
Example – Finding links
In the previous section, we used the strings package to count the number of links on a page. By using the regexp package, we can take this example further and retrieve the actual links with the following regular expression:
<a.*href\s*=\s*[...