$js = <<<JS
...
const urls = ["url","url2","url3"];
let url = urls[0];
...
JS;
preg_match('/urls = \[((?:"([^"]+)",?)+)\]/u', $js, $matches);
<?php
$re = '/(?:urls = \["(?=\w+(?:","\w+){2,9}"\];)|(?!^)\G",")(\w+)/';
$str = <<<JS
...
const urls = ["url1","url2","url3"];
let url = urls[0];
...
JS;
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
var_dump(array_column($matches, 1));
urls.+(\[.*\]);\n
" , "