$re = '/[\r\n]+(?<_KEY_1>[^\n:]+):(?<_VAL_1>[^\r\n]+)/m';
$str = '<plugin_output>
Path : /opt/AdoptOpenJRE/jdk8u332-b09-jre/
Version : 1.8.0_332
Binary Location : /opt/AdoptOpenJRE/jdk8u332-b09-jre/bin/java
Details : This Java install appears to be Java Runtime Environment, since
"jre" was found in the installation path and javac was not found
(medium confidence).
This Java install may be Oracle Java or OpenJDK Java due to
"org.openjdk.java.util" in the binary (low confidence).
Detection Method : "find" utility
</plugin_output>
Variation 2:
<plugin_output>
Path : /HP/hpoa/CADE2/HP/nonOV/openadaptor/1_6_5/classes/oa_jdk14_classes.jar
Version : 1.1.0
JMSAppender.class association : Found
JdbcAppender.class association : Found
JndiLookup.class association : Not Found
Method : MANIFEST.MF dependency
</plugin_output>
Variation 3:
<plugin_output>
Path : /opt/IBM/WebSphere855/AppServer/java_1.7_64/
Installed version : 7.0
Fixed version : 7.0.11.5
Path : /opt/IBM/WebSphere855/AppServer.old/java_1.7_64/
Installed version : 7.0
Fixed version : 7.0.11.5
Path : /opt/IBM/WebSphere855/AppServer.gagan/java_1.7_64/
Installed version : 7.0
Fixed version : 7.0.11.5
Path : /opt/IBM/InstallationManager/eclipse/jre_7.0.100001.20170309_1301/
Installed version : 7.0
Fixed version : 7.0.11.5
</plugin_output>
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php