【问题标题】:Trouble with "URLs must include" with Sphider Search EngineSphider 搜索引擎的“URL 必须包含”问题
【发布时间】:2017-09-24 23:01:39
【问题描述】:

我正在使用Sphider

我想允许 Spider 离开我的域 http://www.example.com,但只抓取/访问包含 example 的 url。意味着只有像 http://www.example.comhttp://www.my-example.comhttp://www.test.example.com 这样的 URL 应该被访问/索引,而不是 http://www.exa-mple.com

阅读manual后,我尝试了以下操作:Screenshot of what I tried.

但我在尝试索引时收到此消息:Image: What I'm getting when trying to index.

谁能帮帮我。我究竟做错了什么?我也已经尝试过*example*,但这也没有用。

【问题讨论】:

  • 您只需要*/example/,但如果您对检查上下文不感兴趣,为什么不在必须包含列表中使用简单的词example
  • @WiktorStribiżew 感谢您的评论。我会试试的。

标签: php regex search search-engine sphider


【解决方案1】:

documentation 包含一个误导性示例:

前面以'*' 开头的每个字符串都被视为正则表达式,因此'*/[a]+/' 表示其中包含一个或多个a 的字符串。

[...] 是一个字符类,它匹配其中定义的集合/范围中的任何单个字符。

您可以使用*/example/ 定义匹配example 字符串的正则表达式。 但是,如果您对检查上下文不感兴趣,不妨在必须包含的列表中使用example 字符串。

【讨论】:

  • 感谢您的回答。它对我帮助很大。谢谢!
【解决方案2】:
^(?=.*example)https?:\/\/\S+$

你可以试试这个。 演示测试在这里https://regex101.com/r/LUkHsD/3

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-01
    • 1970-01-01
    • 2010-11-15
    • 2011-03-25
    • 2019-03-15
    • 2010-10-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多