var str = "Apache/2.2.29 (Gentoo) mod_dp/0.99.7 PHP/7.0.15"; alert(str.match(/(.*?)(?=\s+mod)/)[0].split("/"));
var str = "Apache/2.2.29 (Gentoo) mod_dp/0.99.7 PHP/7.0.15"; alert(str.split("/")[0]); alert(str.match(/[^\/]+(?=\smod)/));