Split string using regular expression in Go

Issue

I’m trying to find a good way to split a string using a regular expression instead of a string. Thanks

http://nsf.github.io/go/strings.html?f:Split!

Solution

If you just want to split on certain characters, you can use strings.FieldsFunc, otherwise I’d go with regexp.FindAllString.

Answered By – Anschel Schaffer-Cohen

Answer Checked By – Robin (GoLangFix Admin)

Leave a Reply

Your email address will not be published.