Regex沙箱:
https://regex101.com/r/nAhuot/1个
我需要用整数对浮点数进行分组.这里的关键字是同一个组.我可以像这样匹配小数点以外的内容:
(\d+)?(.)?(\d+)[ \t]+NUM(\d) <--- Regex to match beyond the decimal
(\d+)[ \t]+NUM(\d) <---- Regex to match up to the decimal
正文如下:
1.5707963267949 NUM0 ;
0 NUM1 ;
0 NUM2 ;
0 NUM3 ;
0 NUM4 ;
0 NUM5 ;
预期的结果是在正则表达式中有2个组,如下所示:
(1.5707963267949,NUM0),(0,NUM1),(0,NUM2),(0,NUM3),(0,NUM4),(0,NUM5)
我的解决方案是多个组,我怎么才能只分成一个组呢?