【发布时间】:2015-02-24 08:50:54
【问题描述】:
我想在遇到某些字符串时以这样的方式处理 php 中的文本。删除遇到该字符串的新行,包括该行之后的行。例如我有如下内容:
This is the sample content.
On 2015-02-19 00:35, notifications@test.com wrote:
> line 1
> line 2 etc
我只想要有意义的内容,在这种情况下
This is the sample content.
然后我想跳过所有内容。目前,我使用
preg_match("/\b, notifications@test.com\b/i",$task_comment_descption,$matches)
但是使用这个我得到,这是示例内容。于 2015-02-19 00:35
【问题讨论】:
-
什么是“有意义的内容”——以清晰的方式给出示例输入和示例输出。
-
这是我现在的实际输出。这是示例内容。在 2015-02-19 00:35,notifications@test.com 写道: > line 1 > line 2 etc.
-
我只想拥有“这是示例内容”。仅作为最终输出。
-
请重新标记此帖子,如果您想解决此帖子,请添加 Regex 标签。
标签: php regex email parsing preg-match