const regex = /<td align=\"left\">\s*(<a href=\"http:\/\/www.proxynova.com\/proxy-server-list\/port-\d+|\d+).*?\s*<\/td>/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('<td align=\\"left\\">\\s*(<a href=\\"http:\\\/\\\/www.proxynova.com\\\/proxy-server-list\\\/port-\\d+|\\d+).*?\\s*<\\\/td>', 'g')
const str = `<table width="950" class="table" id="tbl_proxy_list">
<thead>
<tr>
<th>Proxy IP</th>
<th>Proxy Port</th>
<th>Last Check</th>
<th nowrap="nowrap"><span title="Proxy Speed in bytes per second">Proxy Speed</span></th>
<th>Uptime</th>
<th><span title="The location of that particular proxy.">Proxy Country</span></th>
<th>Anonymity </th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">
<span class="row_proxy_ip">220.225.87.129</span>
</td>
<td align="left">
<a href="http://www.proxynova.com/proxy-server-list/port-8080">8080</a>
</td>
<td align="left">
<time class="icon icon-check timeago" datetime="2016-03-14 12:58:53Z"></time>
</td>
<td align="left">
<div class="progress-bar" data-value="7.7100404" title="5855.0202"></div>
</td>
<td style="text-align:center !important;">
<span style="color:#009900;">59%</span>
</td>
<td align="left">
<img src="//www.proxynova.com/assets/images/blank.gif" class="flag flag-in" width="15" height="11" alt="IN" />
<a href="/proxy-server-list/country-in/">India
<span class="proxy-city"> - Chandannagar </span>
</a>
</td>
<td align="left">
<span class="proxy_transparent" style="font-weight:bold; font-size:10px;">Transparent</span>
</td>
</tr>
<tr>
<td align="left">
<span class="row_proxy_ip">220.225.87.129</span>
</td>
<td align="left">
<a href="http://www.proxynova.com/proxy-server-list/port-8080">8080</a>
</td>
<td align="left">
<time class="icon icon-check timeago" datetime="2016-03-14 12:58:53Z"></time>
</td>
<td align="left">
<div class="progress-bar" data-value="7.7100404" title="5855.0202"></div>
</td>
<td style="text-align:center !important;">
<span style="color:#009900;">59%</span>
</td>
<td align="left">
<img src="//www.proxynova.com/assets/images/blank.gif" class="flag flag-in" width="15" height="11" alt="IN" />
<a href="/proxy-server-list/country-in/">India
<span class="proxy-city"> - Chandannagar </span>
</a>
</td>
<td align="left">
<span class="proxy_transparent" style="font-weight:bold; font-size:10px;">Transparent</span>
</td>
</tr>
<tr>
<td align="left">
<span class="row_proxy_ip">220.225.87.129</span>
</td>
<td align="left">
80
</td>
<td align="left">
<time class="icon icon-check timeago" datetime="2016-03-14 12:58:53Z"></time>
</td>
<td align="left">
<div class="progress-bar" data-value="7.7100404" title="5855.0202"></div>
</td>
<td style="text-align:center !important;">
<span style="color:#009900;">59%</span>
</td>
<td align="left">
<img src="//www.proxynova.com/assets/images/blank.gif" class="flag flag-in" width="15" height="11" alt="IN" />
<a href="/proxy-server-list/country-in/">India
<span class="proxy-city"> - Chandannagar </span>
</a>
</td>
<td align="left">
<span class="proxy_transparent" style="font-weight:bold; font-size:10px;">Transparent</span>
</td>
</tr>
</tbody>
</table>`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions