例如,我使用什么正则表达式从 .txt 文件中包含的以下文本中提取 1.09487?另外,我将如何修改正则表达式以考虑浮点数为负数的情况(例如,-1.948)?
我在 Google 以及正则表达式生成器上尝试了几个建议,但似乎都没有。似乎我想使用锚点(例如 ^)开始在单词“serial”处搜索数字,然后在“(”处停止,但这似乎不起作用。
.txt 文件中的输出:
熵 = 每个字符 7.980627 位。
Optimum compression would reduce the size
of this 51768 character file by 0 percent.
Chi square distribution for 51768 samples is 1542.26, and randomly
would exceed this value less than 0.01 percent of the times.
Arithmetic mean value of data bytes is 125.93 (127.5 = random).
Monte Carlo value for Pi is 3.169834647 (error 0.90 percent).
Serial correlation coefficient is 1.09487 (totally uncorrelated = 0.0).
谢谢你的帮助。