3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '/url(\(((?:[^()]+|(?1))+)\))/m'; $str = 'url(https://exemples.com/fonts/lato/lato/lato-regular-webfont.ttf) src:url(https://exemples.com/fonts/lato/lato-regular-webfont.eot?#iefix) background:url(https://exemples.com/product/header/img.png) background:url(/product/header/img.png) background:url("/product/header/img.png") background:url(\'/product/header/img.png\') background:url(/uploads/2019/03/0002-image(thumbnail_product).jpg) .card-thumb__img1{display:block;width:142px;height:62px;background:url(https://example.com/product01.jpg) center center no-repeat;background-size:contain}@media (max-width:1029px).card-thumb__img2{display:block;z-index:1;background:url(https://example.com/product02.jpg) center center no-repeat #000; background-image: url(/uploads/2019/03/product01-image(thumbnail_photo).jpg); '; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); foreach ($matches as $match) { if (preg_match('/^([\'"]?)[^"]+\1$/', $match[2])) { echo trim($match[2], "'\"") . PHP_EOL; } }
Output for 7.1.25 - 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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
https://exemples.com/fonts/lato/lato/lato-regular-webfont.ttf https://exemples.com/fonts/lato/lato-regular-webfont.eot?#iefix https://exemples.com/product/header/img.png /product/header/img.png /product/header/img.png /product/header/img.png /uploads/2019/03/0002-image(thumbnail_product).jpg https://example.com/product01.jpg https://example.com/product02.jpg /uploads/2019/03/product01-image(thumbnail_photo).jpg

preferences:
164.14 ms | 408 KiB | 5 Q