$re = '/.*?Name: (?<name>.*?)\nversion: (?<num>.*?)\n.*?created on: (?<date>.*?)\n.*?/si';
$str = 'Loading repository data...
Reading installed packages...
Information for patch sdksp3-rpm-201406:
Name: sdksp3-rpm-201406
Version: 9435
Arch: noarch
Vendor: maint-coord@suse.de
Status: Needed
Category: recommended
Created On: Thu Jun 26 11:27:51 2014
Reboot Required: No
Package Manager Restart Required: Yes
Interactive: No
Summary: YOU update for popt
Description:
This update for RPM provides the following fixes and enhancements:
* Add query support for the new weak dependency tags used in SLE 12.
(bnc#884373)
* Remove harmful --target option passing from the configure macro.
(bnc#870358)
* Disable broken ldconfig skipping code. (bnc#725478)
Additionally, one issue was fixed in the rpm-python sub-package:
* Return a PyLong for installsize and archivesize if a PyInt would be
negative. This could make createrepo(8) generate repository metadata
with negative sizes for some packages. (bnc#882489)
Provides:
patch:sdksp3-rpm-201406 == 9435
Conflicts:
popt-devel.x86_64 < 1.7-37.58.1
rpm-32bit.x86_64 < 4.4.2.3-37.58.1
rpm-devel.x86_64 < 4.4.2.3-37.58.1
Loading repository data...
Reading installed packages...
Information for patch sdksp3-rpm-201501:
Name: sdksp3-rpm-201501
Version: 10143
Arch: noarch
Vendor: maint-coord@suse.de
Status: Needed
Category: recommended
Created On: Fri Jan 9 08:15:33 2015
Reboot Required: No
Package Manager Restart Required: Yes
Interactive: No
Summary: Recommended update for rpm
Description:
This update for "rpm" fixes installation of packages when there are spaces
in the path or file name and the option "--noglob" is used.
Provides:
patch:sdksp3-rpm-201501 == 10143
Conflicts:
popt-devel.x86_64 < 1.7-37.62.9
rpm-32bit.x86_64 < 4.4.2.3-37.62.9
rpm-devel.x86_64 < 4.4.2.3-37.62.9
Loading repository data...
Reading installed packages...
Information for patch sdksp3-softwaremgmt-201503:
Name: sdksp3-softwaremgmt-201503
Version: 10576
Arch: noarch
Vendor: maint-coord@suse.de
Status: Needed
Category: recommended
Created On: Tue Apr 7 09:29:23 2015
Reboot Required: No
Package Manager Restart Required: Yes
Interactive: No
Summary: YOU update for the Software Update Stack
Description:
This collective update for the Software Update Stack provides several fixes
and enhancements.
libsatsolver:
* Support product end-of-life attribute. (FATE#300591)
libzypp:
* Improve conflict message for locked packages. (bsc#828631)
* Add Product::endOfLife attribute. (FATE#316172, FATE#300591)
PackageKit:
* When a proxy server is configured, a default route is not mandatory.
(bsc#910462)
rpm:
* Allow noscripts and notriggers on verify. (bsc#803669)
yast2-pkg-bindings:
* Use alias from URL query parameter if present. (bsc#892431)
zypper:
* A date limit must ignore newer patch candidates. (bsc#919709)
* Show locked packages in zypper summary. (FATE#318256)
* Refresh plugin services on \'lr\' \'ls -r\' and \'ref\'. (bsc#893294,
FATE#317863)
* Enhance \'Digest verification failed\' dialog. (FATE#315008)
* Add Product::endOfLife attribute. (FATE#316172, FATE#300591)
Provides:
patch:sdksp3-softwaremgmt-201503 == 10576
Conflicts:
PackageKit-devel.x86_64 < 0.3.14-2.30.11
libpackagekit-glib10-devel.x86_64 < 0.3.14-2.30.11
libpackagekit-qt10.x86_64 < 0.3.14-2.30.11
libpackagekit-qt10-devel.x86_64 < 0.3.14-2.30.11
libsatsolver-devel.x86_64 < 0.17.9-0.5.2
libzypp-devel.x86_64 < 9.38.4-0.7.10
popt-devel.x86_64 < 1.7-37.63.64.1
rpm-32bit.x86_64 < 4.4.2.3-37.63.64.1
rpm-devel.x86_64 < 4.4.2.3-37.63.64.1
ruby-satsolver.x86_64 < 0.44.5-0.5.194
yast2-pkg-bindings-devel-doc.noarch < 2.17.59.2-0.8.13
Loading repository data...
Reading installed packages...
';
$subst = "\g<name> \g<num> \g<date>\n";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
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