删除所有内容,每行除一个单词外

问题描述

我正在尝试找到一种正则表达式解决方案,以保留&#xA;并删除其他内容而不会破坏行顺序。只有某些行包含此模式一次或多次。我尝试了(?<=&#xA;)(.+)|(.+)(?=&#xA;)|^((?!&#xA;).)*$,但尽管其中包含更多行,但每行仅保留一个行。例如,我有这样的东西:

The client requires photos of a radioactive world&#xA;Reach the target planet.
The client requires photos.&#xA;&#xA;Reach the target planet.
The client requires photos of a desert world&#xA;Reach the target planet.
The client requires photos of an airless world. Reach the target planet.
The client requires photos of a strange world&#xA;&#xA;Reach the target planet&#xA;Make a quick scan.

正是如此:

&#xA;
&#xA;&#xA;
&#xA;

&#xA;&#xA;&#xA;

如果您有帮助,我会很高兴。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)