忽略时间戳,如何删除以下非聊天重复项?聊天有 2 种格式
- 以尖括号包围的昵称开头,并且
- 以昵称开头,后跟“告诉您:”。
如果它是在 Notepad++ 中完成的,我更喜欢,但由于 Cygwin,我还可以访问多个实用程序。
原来的
[16:29] You see a sheep; it looks like it weighs about 98.
[16:30] You see a sheep; it looks like it weighs about 100.
[16:52] anonymized tells you: Do you know the bank yet?
[17:11] Only anonymized may access the corpse for now.
[17:12] Only anonymized may access the corpse for now.
[17:14] <anonymized> You can do it later.
[17:14] <anonymized> The dagger for example
[17:15] <anonymized> The dagger for example
[17:15] <dynv> hi
[17:32] gnome has been killed by anonymized and dynv
[17:32] The corpse is too far away.
[17:32] The corpse is too far away.
[17:33] anonymized: now is gets dangerous
期望的结果
[16:29] You see a sheep; it looks like it weighs about 98.
[16:30] You see a sheep; it looks like it weighs about 100.
[16:52] anonymized tells you: Do you know the bank yet?
[17:11] Only anonymized may access the corpse for now.
[17:14] <anonymized> You can do it later.
[17:14] <anonymized> The dagger for example
[17:15] <anonymized> The dagger for example
[17:15] <dynv> hi
[17:32] gnome has been killed by anonymized and dynv
[17:32] The corpse is too far away.
[17:33] anonymized: now is gets dangerous
非常感谢你
^\[.+?] (?!<\w+>|\w+ tells you:)(.+)\K\R\[.+?] \1
EMPTY
. matches newline
解释:
截图(之前):
截图(之后):
我通常认为程序方法比完全基于正则表达式的魔法更容易理解,即使它需要不止一行: