3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/^([^:\n\r]+):(.*(?:\R(?![^:\n\r]+:[^:\n\r]*$).*)*)/m'; $str = 'Name: John Doe Age: 23 Primary Language: English Description: This is a multiline description field that I want to capture Fri, 02 Sep 2022 14:46:45 -0500 Country: Canada'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); print_r($matches);

preferences:
48.82 ms | 405 KiB | 5 Q