正则表达式,获取值结束标记

Hello this is my code:

<?php
require('/simple_html_dom.php');
$html = new simple_html_dom();
$html = file_get_html('proxys.html');

$items = array();
$re = "/<td class=\\\"t_ip\\\">\\s*((?:[0-9]{1,3}\\.){3}[0-9]{1,3})\\s*<\\/td>(?:.*?)*<td class=\"t_port\">(?:.*?)\\w+\\^\\w+\\^([0-9]{1,5})(?:.*?)<td class=\"t_type\">\\s*([0-9])(?:.*?)/"; 

        preg_match_all($re, $html, $matches, PREG_SET_ORDER);
        foreach ($matches as $val) {
        echo nl2br($val[1] . ':' . $val[2] . ' ' . $val[3] . "
");
        };

?>

proxys.html

<td class="t_ip">104.131.248.140</td><td class="t_port">           <script type="text/javascript">           //<![CDATA[             document.write(BigBlind^BigBlind^60088);           //]]>           </script>50088         </td><td class="t_type">     5         </td><td class="t_ip">79.101.32.14</td><td class="t_port">           <script type="text/javascript">           //<![CDATA[             document.write(Polymorth^Polymorth^1080);           //]]>           </script>45080         </td>

The problem is that the value is obtained "60088" of ****document.write(BigBlind^BigBlind^60088);****

104.131.248.140:    60088 5
79.101.32.14:       1080 4

and would like to get the value of < / script>50088

104.131.248.140:    50088 5
79.101.32.14:       45080 4

I'm lost with regular expression, Thank you for your help

You can try using DOMDocument like as

$html = '<td class="t_ip">104.131.248.140</td><td class="t_port">           <script type="text/javascript">           //<![CDATA[             document.write(BigBlind^BigBlind^60088);           //]]>           </script>50088         </td><td class="t_type">     5         </td><td class="t_ip">79.101.32.14</td><td class="t_port">           <script type="text/javascript">           //<![CDATA[             document.write(Polymorth^Polymorth^1080);           //]]>           </script>45080         </td>';

$dom = new DOMDocument;
$dom->loadHTML($html);
$root = $dom->documentElement;
$tds = $root->getElementsByTagName("td");
foreach($tds as $key => $value){
    echo $value->parentNode->textContent."<br>";
}