开发者

Should I use Parse::RecDescent or Regexp::Grammars to extract tables from documents?

I have lots of large plain text documents I wish to parse with perl. Each document has mostly English paragraphs in it, with a couple of plain text marked up tables in each document.

I have created a grammar to describe the table structure, but am unsure whether it would be best to use Parse::RecDescent or Regexp::Grammars to extract the tables.

I initially leaned towards Parse::RecDescent, but I'm not sure in a grammar how you would deal with the 90% of the document text I want to ignore, in order to find开发者_运维百科 the couple of tables I want to extract buried inside each document.

Perhaps I need Regexp::Grammars so I can "pull" my expression through the document until it finds matches?

Thanks


Regexp::Grammars is what I wanted, as it allows you to pull your grammar through the document and find matches like a regular expression. Parse::RecDescent doesn't seem suited to scanning through a document and finding only the text that matches the grammar.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜