Jump to content

Extracting a value (noob question)


Mycotheologist

Recommended Posts

I need to extract some data from text files, heres the line in the text file containing the value that I need:

SCF Done:  E(RB3LYP) =  -3540.94178466    A.U. after  20 cycles

the value that I need is -3540.94178466.

 

Heres the code I am using:

if (preg_match_all('/SCF Done:  E\(RB3LYP\) = (.*?)A.U./msU',$file_contents,$matches)) { $content = $matches[0][0]; }
echo $content;

When I echo the $content variable, heres what it outputs:

SCF Done: E(RB3LYP) = -3540.94178466 A.U.

How can I output the value itself, without the delimiters? In other words, I need to output just the value -3540.94178466, not the crap surrounding it.

Link to comment
https://forums.phpfreaks.com/topic/265059-extracting-a-value-noob-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.