-
-
Save theqp/98373e203483c65fbd93152a795a91f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RegexReadPrice where | |
import qualified Data.ByteString.Lazy.Char8 as C | |
import Data.Function ((&)) | |
import GHC.Arr (Array, elems) | |
import Text.Regex.TDFA (getAllTextMatches, (=~)) | |
import Control.Arrow ((>>>)) | |
-- >>> matches (C.pack "1") | |
-- [["1","1"],["",""]] | |
matches :: C.ByteString -> [[String]] | |
matches s = | |
(getAllTextMatches (s =~ "(.*)") :: Array Int (Array Int C.ByteString)) | |
& elems | |
& fmap (elems >>> fmap C.unpack) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment