1
tjxwork 2023-07-30 11:41:17 +08:00
https://regex101.com/
正则表达式 (.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,}) .*?(\(.*?\)).*?(\(.*?\)) (.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,}) .*?(\(.*?\)).*?(\(.*?\)) (.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,}) .*?(\(.*?\)).*?(\(.*?\)).*?(\(.*?\)).*?(\(.*?\)) 换行部分自己换成"\n" 测试文本 〖 BH 〗 AAA 〖〗〖〗〖〗〖〗 0.020 〖〗-0.017 〖 BH 〗〖〗〖〗〖〗〖〗(0.027)〖〗(0.015) 〖 BH 〗 BBB 〖〗〖〗〖〗〖〗-0.225 〖〗 0.018 〖 BH 〗〖〗〖〗〖〗〖〗(0.113)〖〗(0.009) 〖 BH 〗 CCC 〖〗-1.087 〖〗 0.413 〖〗〖〗-0.966 〖〗 1.033 〖 BH 〗〖〗(0.147)〖〗(0.081)〖〗〖〗(0.175)〖〗(0.323) 替换 $1$2$5$3$4$6\n$7$8$11$9$10$12\n$13$14$21$15$16$22$17$18$23$19$20$24 结果 〖 BH 〗 AAA 〖〗〖〗〖〗〖〗 0.020(0.027) 〖〗-0.017(0.015) 〖 BH 〗 BBB 〖〗〖〗〖〗〖〗-0.225(0.113)〖〗 0.018(0.009) 〖 BH 〗 CCC 〖〗-1.087(0.147)〖〗 0.413(0.081)〖〗〖〗-0.966(0.175)〖〗 1.033(0.323) 来,V 我 50 |
2
tjxwork 2023-07-30 11:46:44 +08:00
|
3
paopjian 2023-07-30 12:12:23 +08:00
这种逻辑合并,把空格当做分隔符处理表格可以吗
|
4
28Sv0ngQfIE7Yloe 2023-07-30 12:14:42 +08:00
我觉得有比正则更好的方案
|
7
tjxwork 2023-07-30 13:02:11 +08:00
@iamhrh2
VSCode Ctrl+H Alt+R 启用正则 分别粘贴 查找 (.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,})\n.*?(\(.*?\)).*?(\(.*?\))\n(.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,})\n.*?(\(.*?\)).*?(\(.*?\))\n(.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,})\n.*?(\(.*?\)).*?(\(.*?\)).*?(\(.*?\)).*?(\(.*?\)) 替换 $1$2$5$3$4$6\n$7$8$11$9$10$12\n$13$14$21$15$16$22$17$18$23$19$20$24 |
8
tjxwork 2023-07-30 13:04:53 +08:00
@iamhrh2
EmEditor 查找,点 “>” 启用多行 (.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,}) .*?(\(.*?\)).*?(\(.*?\)) (.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,}) .*?(\(.*?\)).*?(\(.*?\)) (.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,})(.*?)(-?\d.\d{3,}) .*?(\(.*?\)).*?(\(.*?\)).*?(\(.*?\)).*?(\(.*?\)) 替换为 \1\2\5\3\4\6 \7\8\11\9$10$12 $13$14$21$15$16$22$17$18$23$19$20$24 EmEditor 这替换怪得很…… |
9
tjxwork 2023-07-30 13:06:47 +08:00
|