3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $matches=array(); preg_match_all('/(.*?):(?:".*?"|.*?)(?=\r?\n|\r\n?)/s', 'name: dc_tun_2943 remote-gateway: 83.113.63.244:4500 lifetime/rekey: 21600/9358 inbound:" spi: 0a23d4b9 enc: aes 0f076cac2c56262e87595b89628394ff auth: sha1 dfe2b661f857725fbcf7f14976dae6ded3f4e824" outbound:" spi: cf34c010 enc: aes d463c815a141f714dbc58cdddde04bec auth: sha1 e5af683ab3f83634bca4eeb3ac081e7a7de2e5a1" ', $matches); var_dump($matches);
based on 8qPus
Output for 4.3.0 - 7.3.0rc4
array(2) { [0]=> array(5) { [0]=> string(17) "name: dc_tun_2943" [1]=> string(38) " remote-gateway: 83.113.63.244:4500 " [2]=> string(36) " lifetime/rekey: 21600/9358 " [3]=> string(157) " inbound:" spi: 0a23d4b9 enc: aes 0f076cac2c56262e87595b89628394ff auth: sha1 dfe2b661f857725fbcf7f14976dae6ded3f4e824"" [4]=> string(158) " outbound:" spi: cf34c010 enc: aes d463c815a141f714dbc58cdddde04bec auth: sha1 e5af683ab3f83634bca4eeb3ac081e7a7de2e5a1"" } [1]=> array(5) { [0]=> string(4) "name" [1]=> string(17) " remote-gateway" [2]=> string(21) " lifetime/rekey" [3]=> string(14) " inbound" [4]=> string(15) " outbound" } }