regex - Extract Float from Specific String Using Regular Expression -
what regular expression use extract, example, 1.09487 following text contained in .txt file? also, how modify regular expression account case float negative (for example, -1.948)?
i tried several suggestions on google regular expression generator, none seem work. seems want use anchor (such ^) start searching digits @ word "serial" , stop @ "(", doesn't seem work.
output in .txt file:
entropy = 7.980627 bits per character.
optimum compression reduce size of 51768 character file 0 percent. chi square distribution 51768 samples 1542.26, , randomly exceed value less 0.01 percent of times. arithmetic mean value of data bytes 125.93 (127.5 = random). monte carlo value pi 3.169834647 (error 0.90 percent). serial correlation coefficient 1.09487 (totally uncorrelated = 0.0).
thanks help.
this should sufficient:
(?<=serial correlation coefficient )[-\d.]+
unless you're expecting garbage, work fine.
Comments
Post a Comment