# 无法输入匹配电话号码的已监控词汇正则表达式

**URL:** https://meta.discourse.org/t/cant-enter-watched-words-regex-to-catch-phone-numbers/366534
**Category:** Support
**Tags:** regex, watched-words
**Created:** [2025 年5 月 17 日 06:12 UTC](https://meta.discourse.org/t/cant-enter-watched-words-regex-to-catch-phone-numbers/366534 "2025-05-17T06:12:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [2025 年5 月 17 日 06:12 UTC](https://meta.discourse.org/t/cant-enter-watched-words-regex-to-catch-phone-numbers/366534/1 "2025-05-17T06:12:31Z")

</div>

您好！

我们收到了大量 Akismet 未能拦截的垃圾邮件。这些邮件通常包含（国际）电话号码，这让我们想到使用正则表达式来拦截它们。

经过一番试验，我们找到了以下表达式：

```plaintext
(?:\\+|00)?\\d{1,3}?[-\\s]?\\d{2,4}[-\\s]?\\d{2,4}[-\\s]?\\d{2,4}|\\b\\d{10}\\b

```

但是，由于管理屏幕将其分割成单独的块，我们无法输入它：

 ![图片显示了一个文本编辑器界面，其中一个突出显示的框包含一个正则表达式以及表达式中使用的各种字符代码。（由 AI 标注）](https://global.discourse-cdn.com/meta/original/4X/9/7/e/97e6c7325d3a4bcb02f73b24acef91550bdc6b4d.png)

您有什么处理此问题的建议吗？

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2025 年5 月 17 日 06:49 UTC](https://meta.discourse.org/t/cant-enter-watched-words-regex-to-catch-phone-numbers/366534/3 "2025-05-17T06:49:27Z")

</div>

我认为它在复制粘贴正则表达式时会拾取管道符 `|`。我认为如果手动输入，它可能会忽略它们作为分隔符，并允许您将其作为一个条目来处理。🤞

**预计到达时间：** 快速测试表明这很有希望。👍

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [2025 年5 月 17 日 07:27 UTC](https://meta.discourse.org/t/cant-enter-watched-words-regex-to-catch-phone-numbers/366534/4 "2025-05-17T07:27:51Z")

</div>

太棒了，解决了！👍

---

<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: [2025 年6 月 16 日 07:28 UTC](https://meta.discourse.org/t/cant-enter-watched-words-regex-to-catch-phone-numbers/366534/5 "2025-06-16T07:28:46Z")

</div>

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