<?php
$string = "01/11/2016 Aggregated Micro Power Holdings plc (AMPH) JPMorgan Global Growth & Income plc (JPGI) Murray Income Trust plc (MUT)";
preg_match_all('/(?P<date>\d+\/\d+\/\d+)\s|\G\s*(?P<company>.*?)\s*\((?P<epic>.*?)\)/', $string, $matches, PREG_SET_ORDER);
var_dump($matches);
- Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- array(4) {
[0]=>
array(3) {
[0]=>
string(11) "01/11/2016 "
["date"]=>
string(10) "01/11/2016"
[1]=>
string(10) "01/11/2016"
}
[1]=>
array(7) {
[0]=>
string(42) "Aggregated Micro Power Holdings plc (AMPH)"
["date"]=>
string(0) ""
[1]=>
string(0) ""
["company"]=>
string(35) "Aggregated Micro Power Holdings plc"
[2]=>
string(35) "Aggregated Micro Power Holdings plc"
["epic"]=>
string(4) "AMPH"
[3]=>
string(4) "AMPH"
}
[2]=>
array(7) {
[0]=>
string(43) " JPMorgan Global Growth & Income plc (JPGI)"
["date"]=>
string(0) ""
[1]=>
string(0) ""
["company"]=>
string(35) "JPMorgan Global Growth & Income plc"
[2]=>
string(35) "JPMorgan Global Growth & Income plc"
["epic"]=>
string(4) "JPGI"
[3]=>
string(4) "JPGI"
}
[3]=>
array(7) {
[0]=>
string(30) " Murray Income Trust plc (MUT)"
["date"]=>
string(0) ""
[1]=>
string(0) ""
["company"]=>
string(23) "Murray Income Trust plc"
[2]=>
string(23) "Murray Income Trust plc"
["epic"]=>
string(3) "MUT"
[3]=>
string(3) "MUT"
}
}
preferences:
270.99 ms | 406 KiB | 291 Q