$re = '/<\!--\[if\s+lt\s+IE\s+\d][^>]*>(.*)<\!\[endif\]-->/Uis';
$str = '
rwerwerw
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
rwerwerwerwe
<script type="text/javascript">
jQuery(window).on(\'load\', function() {
new JCaption(\'img.caption\');
});
if (typeof RokBoxSettings == \'undefined\') RokBoxSettings = {pc: \'100\'};
jQuery(document).ready(function()
{
jQuery(\'.hasTooltip\').tooltip({"html": true,"container": "body"});
});
jQuery(document).ready(function (){
jQuery(\'.minicolors\').each(function() {
jQuery(this).minicolors({
control: jQuery(this).attr(\'data-control\') || \'hue\',
position: jQuery(this).attr(\'data-position\') || \'right\',
theme: \'bootstrap\'
});
});
});
jQuery(function(){
new JVMenu(\'#\',{
main: {
delay: 300,
duration: 300,
effect: \'fade\',
easing: \'linear\'
},
sub: {
delay: 300,
duration: 300,
effect: \'slide\',
easing: \'linear\'
},
responsive: 992
});
})
jQuery(function(){new JVTop();});
jQuery(function($){ });
</script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php