Python 正则表达式去除重复行

来源:互联网 发布:qq飞车幻想战神数据 编辑:程序博客网 时间:2024/06/05 06:20
1. Sort lines and remove adjacent duplicatesMatch:(?m)^([\s\S]*)(?:(?:\r?\n|\r)\1)+$Replace:\12. Keep the last occurrence of each duplicate line in an unsorted fileMatch:(?m)^([^\r\n]*)(?:\r?\n|\r)(?=[\s\S]*^\1$)Replace:None3. Keep the first occurrence of each duplicate line in an unsorted fileMatch:(?m)^([^\r\n]*)$([\s\S]*?)(?:(?:\r?\n|\r)\1$)+Repace:\1\2

0 0
原创粉丝点击