Closed farao closed 6 years ago
I would recommend fmap
ing drop
over the all of the matches, and then pattern matching to pull out the first element:
scrapeStringLike "<div><p>One</p><p>Two</p></div>" $ do
a:_ <- drop 1 <$> texts "p"
return a
Failing a pattern match inside the Scraper monad is safe because it is an instance of MonadFail.
Hi,
in scalpel there some functions that simply return the "first match" - e.g. text or chroot. Is there a way to select/chroot the nth matching element? Suppose, I have the following HTML:
One
Two
Now I want to select only the second
- is there a way to do this?
Thanks, Marius