regex 要匹配字符串中重复数字的正则表达式

ccgok5k5  于 2023-06-25  发布在  其他
关注(0)|答案(1)|浏览(119)

我有一个这样的列,我只想挑选有重复数字的行

Col A
100,100,100,100,100,100,100,100,100,100,100
3,61,3,145,61,61,61,61
299,295,299.5,300,299.5,299
5.98,5.98,397.56,405.51,398.53,7.95,405.51,405.51,398.53
482.14,1522.12,1001.92,1990.39,1000,1999.79
649.36,610.4,1136.75,626.78,590.34
2284.58,1773.35,2169.48,1760.41,1256.36
2979.55,3032.63,3023.23,2505.15
431,154.5,179
302.95,304,304
339.96,159.27,340.74,160.04,153.46,346.54
170,170,170
968.41,8.86,486.5,360.4,102.64
420,500,500
200,250,250

regex匹配具有重复数字的行
1.它们也可以由不匹配的数字分开

cbwuti44

cbwuti441#

使用捕获组来捕获每个数字,并使用反向引用来匹配数字的重复。

\b(\d+(?:\.\d+)?)\b.*\b\1\b

DEMO

相关问题