# Regexp 转义在电子邮件中的解释

**URL:** https://meta.discourse.org/t/regexp-escapes-interpreted-in-emails/184673
**Category:** Bug
**Created:** [2021年三月28日 20:42 UTC](https://meta.discourse.org/t/regexp-escapes-interpreted-in-emails/184673 "2021-03-28T20:42:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2021年三月28日 20:42 UTC](https://meta.discourse.org/t/regexp-escapes-interpreted-in-emails/184673/1 "2021-03-28T20:42:00Z")

</div>

> **[\\0 (just for fun)](https://internals.rust-lang.org/t/0-just-for-fun/14273)**
>
> An amusing Discourse bug: In my email notifications from the thread Convenient null-terminated string literals, all of the code samples have the string \\0 (or for anyone reading this by email, backslash zero) replaced with the string...

在帖子内容或主题标题中放置一个 `\0`，当作为电子邮件通知发送时，它将被替换为第一个格式占位符。

\0

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2021年七月8日 22:56 UTC](https://meta.discourse.org/t/regexp-escapes-interpreted-in-emails/184673/4 "2021-07-08T22:56:19Z")

</div>

已修复！

> <https://github.com/discourse/discourse/pull/13641>
>
> https://meta.discourse.org/t/regexp-escapes-interpreted-in-emails/184673
> 
> 
> 
> …This changes from providing a string literal for the #sub replacement, to providing a block.
> Because the block is provided the match object, it is presumed to have already performed all necessary backreferences.
> This avoids any replacement of backreferences in the message body.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2021年七月12日 15:00 UTC](https://meta.discourse.org/t/regexp-escapes-interpreted-in-emails/184673/5 "2021-07-12T15:00:35Z")

</div>

此主题已在 3 天后自动关闭，不再允许新回复。
