0

我是 webharvest 的新手,正在使用它从网站获取文章数据,使用以下语句:

let $text := data($doc//div[@id="articleBody"])

这是我从上述声明中得到的数据:

The Refine Spa (Furman's Mill) was built as a stone grist mill along the on a tributary of Capoolong Creek by Moore Furman, quartermaster general of George Washington's army

Notable people

Notable current and former residents of Pittstown include:

我的问题是,是否可以在上面的示例中从另一个字符串中减去一个字符串:内容中的“知名人士”。

有可能这样做吗?如果可能,请让我知道如何。谢谢。有什么我可以这样做的:

if (*contains*($text, 'Notable people')) then $text := *minus*($text, 'Notable people') 

contains是一个示例函数名称,用于确定一个字符串是另一个的子字符串,减号是一个示例函数名称,用于从另一个中删除子字符串

所需的输出:

The Refine Spa (Furman's Mill) was built as a stone grist mill along the on a tributary of Capoolong Creek by Moore Furman, quartermaster general of George Washington's army

Notable current and former residents of Pittstown include:
4

1 回答 1

1

http://web-harvest.sourceforge.net/manual.php

正则表达式

在正文中搜索给定的正则表达式,并可选择用指定的模式替换找到的匹配项。如果 body 是值列表,则正则表达式处理器应用于每个项目,最终执行结果是列表。

你只需要使用正确的正则表达式正确regexp-pattern和正确regexp-result

于 2013-09-18T10:15:57.590 回答