[Haskell-beginners] Question about Regular expression pattern consuming.

S. H. Aegis shaegis at gmail.com
Sun Jul 28 11:35:27 CEST 2013


Hi.
I'm newbie to Haskell.
I want to get date, it's type is [[String]].
The problem is that "the string that is used in regular expression pattern"
is consumed. ie, disappear.
Here is my code.

------------------------------------------------------------
import Text.Regex
import Control.Applicative

main :: IO()
main = do
    myIn <- readFile "Data.dat"
    print $ lines <$> intoEachPt myIn

intoEachPt :: String -> [String]
intoEachPt = splitRegex (mkRegex "20[0-9]{13}AH021")
-----------------------------------------------------------

How can I fix this?


Data:
....there is many DIGIT.....201306000300001AH02112361640
9.......

Output:
[[....there is many DIGIT..."],["12361640             9......]....]

I hope:
[[....there is many DIGIT..."],["201306000300001AH02112361640
9......]....]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130728/6b3376f0/attachment.htm>


More information about the Beginners mailing list