haskell - Ignoring letters and parsing only numbers using Parsec -


this code works when numerals (eg: "1243\t343\n") present:

tabfile = endby line eol line = sepby cell (many1 tab) cell = integer eol = char '\n'  integer = rd <$> many digit   rd = read :: string -> int 

is there way make parse "abcd\tefg\n1243\t343\n" such ignores "abcd\tefg\n" part ?

you can skip except digits using skipmany. next:

many (skipmany (noneof ['0'..'9']) >> digit) 

or (depending on need)

skipmany (noneof ['0'..'9']) >> many digit 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -