JSFiddle - React, Tailwind, and code Playground
by Hans PUFAL
HTML
<pre id="results"></pre>
JavaScript
document.getElementById ('results').innerHTML = [
'HTZ_2015_CS_SS5_cncenter_1020x200_AS2_10K.html',
'HTZ_2015_CS_SS5_cncenter_1020x200_AS2_10K.swf',
'HTZ_2015_CS_SS5_cncenter_1500x1000_160K_w1020.jpg',
'Anther test string'
].map (function (src) {
return (src.match (/^((?:[^_]*_){5}[^_]*)(_[^]*)$/) || [,src])[1]
}).join ('\n');