0

私は webharvest を初めて使用し、次のステートメントを使用して、Web サイトから記事データを取得するために使用しています。

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は、文字列が別の文字列の部分文字列であるかどうかを判断するための関数名の例です。minusは、別の文字列から部分文字列を削除するための関数名の例です

望ましい出力:

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 に答える