# 数据浏览器查询，在私信中发布电话号码时通知版主

**URL:** <https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777>\
**Category:** Support\
**Created:** [2020年八月4日 12:24 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777 "2020-08-04T12:24:22Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)\
**Post date:** [2020年八月4日 12:24 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/1 "2020-08-04T12:24:22Z")

</div>

您希望完成什么任务？

大家好，

由于我们的论坛是匿名运行的，我们希望保护会员的隐私。

为此，我们希望能 **实现一个数据探索器查询，每当有包含电话号码的私信发送时，向版主发出警告** 。

@SidV 曾在此提供一个优秀的数据探索器查询模板：

> <https://github.com/SidVal/discourse-data-explorer/blob/queries/queries/search-term-pm.sql>

您需要何时完成？

8 月 15 日

您能为此任务提供的预算（美元）是多少？

50 美元

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2020年八月4日 14:17 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/2 "2020-08-04T14:17:39Z")

</div>

你觉得电话号码长什么样？

---

<div class="post-metadata">

**Author:** ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)\
**Post date:** [2020年八月4日 14:24 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/3 "2020-08-04T14:24:20Z")

</div>

基本上是这样：

> **[Telephone numbers in Germany](https://en.wikipedia.org/wiki/Telephone_numbers_in_Germany)**
>
> The regulation of telephone numbers in Germany is the responsibility of the Federal Network Agency (German: Bundesnetzagentur, BNetzA) of the German government. The agency has a mandate to telecommunications in Germany and other infrastructure systems.
> Germany has an open telephone numbering plan with variable sizes of area codes and subscriber telephone numbers. Before 2010, area codes and subscriber telephone numbers had no fixed size, meaning that some subscriber numbers may be as short as...

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2020年八月4日 14:26 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/4 "2020-08-04T14:26:20Z")

</div>

是这个吗？

```
 (0xx) xxxx-xxxx

```

---

<div class="post-metadata">

**Author:** ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)\
**Post date:** [2020年八月4日 14:28 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/5 "2020-08-04T14:28:07Z")

</div>

基本上，任何超过 9 位数字且以 +49 或 0 开头的号码……  
数字之间的任何特殊字符都应被忽略。

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2020年八月4日 14:53 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/6 "2020-08-04T14:53:16Z")

</div>

> [@jrgong](#):
>
> 基本上

要解决你的问题，我需要你明确说明你认为什么是电话号码，而不是“基本上”。用“基本上”的方式解决，是一个价值 500 到 5000 美元的问题。

所以，任何以“+49”开头，后面跟 10 位或更多数字的号码，且 `~!@#$%^&*()` 可以穿插在这些 10 位或更多数字中，但不计入总位数，是这样吗？

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2020年八月5日 00:39 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/7 "2020-08-05T00:39:17Z")

</div>

我相当确定使用管理员功能、日志和正则模式下的监控词已经可以实现这一点。在构建该正则表达式时，您需要非常非常小心。

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2020年八月5日 00:58 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/8 "2020-08-05T00:58:36Z")

</div>

那本来是我解决方案的一部分，不过正如你所指出的，如何定义什么是电话号码，远非一件简单的事。

---

<div class="post-metadata">

**Author:** ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)\
**Post date:** [2020年八月5日 08:52 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/9 "2020-08-05T08:52:57Z")

</div>

谢谢您的反馈。  
我们将尝试这种方式。

主题可以关闭。

---

<div class="post-metadata">

**Author:** ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)\
**Post date:** [2020年八月5日 08:58 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/10 "2020-08-05T08:58:51Z")

</div>

这是一个匹配电话号码的正则表达式示例：

```plaintext
^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$

```

这是另一个示例：

```plaintext
^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$

```

您可以随意修改…… 您可以使用在线正则表达式测试工具进行测试，这类工具有很多。

希望这能帮到您。

---

<div class="post-metadata">

**Author:** ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)\
**Post date:** [2020年八月5日 09:02 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/11 "2020-08-05T09:02:21Z")

</div>

哇，非常感谢，谢谢！  
我们会进行测试。

---

<div class="post-metadata">

**Author:** ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)\
**Post date:** [2020年八月5日 09:03 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/12 "2020-08-05T09:03:30Z")

</div>

欢迎！@jrgong

以下是其中一个示例的在线 REGEX 测试器：

[https://regexr.com/3c53v](https://regexr.com/3c53v)

您可以使用该网站或类似的网站来测试您感兴趣的数字格式。

---

<div class="post-metadata">

**Author:** ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)\
**Post date:** [2020年八月5日 11:47 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/13 "2020-08-05T11:47:31Z")

</div>

谢谢

只有一个快速问题：如何设置正则表达式以忽略 8 位或更少的数字？

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2020年九月4日 11:47 UTC](https://meta.discourse.org/t/data-explorer-query-to-alert-moderators-when-phone-numbers-are-posted-in-private-messages/159777/14 "2020-09-04T11:47:33Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
