[web-devel] [Newbie][Parsec] Skipping to desired phrase

Kamil Ciemniewski ciemniewski.kamil at gmail.com
Fri Jul 29 10:27:32 CEST 2011


Hi all,

I've got a String containing html and I'd like
to extract from it some informations..

Specifically these informations start at point
"after" some phrase ( let say "nicelinks").

How do I skip all the html up to the point
of this phrase?

I've done that much already:

p_rest = do
  skipMany ((try (string "nicelinks")) <|> anyHeadString)
  text <- many1 anyChar
  return [text]

anyHeadString = do
  c <- anyChar
  return [c]

But after doing:
parse p_rest [] html

I get:
Left (line 112, column 15):
unexpected end of input
expecting "nicelinks"

What am I doing wrong?

Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110729/9e51c5b9/attachment.htm>


More information about the web-devel mailing list