package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`[\s.,\/\(\):\n]+`)
var str = `The Constitution of the United States: A Transcription
Note: The following text is a transcription of the Constitution as it was inscribed by Jacob Shallus on parchment (the document on display in the Rotunda at the National Archives Museum.) Items that are hyperlinked have since been amended or superseded. The authenticated text of the Constitution can be found on the website of the Government Printing Office.
We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America.`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/