How do I split a string using a regex?
问题 I’d like to split a string using a regular expression. I have browsed the various regex modules on Hackage, but I can’t make any sense of them. (I have noticed Data.List.Split , but it doesn’t seem to offer what I need, either.) 回答1: This may help you: ghci > import Text.Regex.Posix ghci > getAllTextMatches ("good food" =~ ".ood" :: AllTextMatches [] String) ["good","food"] Real world haskell book has a nice chapter on it. 来源: https://stackoverflow.com/questions/20128557/how-do-i-split-a