我有一个巨大的文件,其中包含带小数的数字,如下所示
31.3043 31.3043 31.3043 31.3043 31.3043 31.3043 31.3043
200 200 200 200 200 200 200
121.739 121.739 121.739 121.739 121.739 121.739 121.739
10.4348 10.4348 10.4348 10.4348 10.4348 10.4348 10.4348
5.2174 5.2174 5.2174 5.2174 5.2174 5.2174 5.2174 5.2174
我只想搜索的是10以上的数字
31.3043 31.3043 31.3043 31.3043 31.3043 31.3043 31.3043
200 200 200 200 200 200 200
121.739 121.739 121.739 121.739 121.739 121.739 121.739
10.4348 10.4348 10.4348 10.4348 10.4348 10.4348 10.4348
不包括数字
5.2174 5.2174 5.2174 5.2174 5.2174 5.2174 5.2174 5.2174
这样做的工作:
(?<![.\d])\d{2,}(?:\.\d+)?
说明:
(?<![.\d]) : negative lookbehind, make sure we have not digit or dot before current position
\d{2,} : 2 or more digits
(?:\.\d+)? : optional non capture group, for decimal part