var txt = `1280х720,
1280х720 (х кириллица)
1280 х 720
1280 х 720 (х кириллица)`;
var arr = txt.split(/(?:,?\r?\n)+/);
console.log(arr)
<?
function parseTpl($tpl, $values = array(), $left = '%%', $right = '%%') {
foreach ($values as $key => $value) {
$tpl = str_replace('%%'.$key.'%%', $value, $tpl);
}
$tpl = preg_replace('/('.$left.'.*?'.$right.')/' ,'', $tpl);
return $tpl;
}
$tpl = '
<tr>
<td><strong>%%matr_sever.title%%</strong></td>
<td colspan="2">%%matr_sever.value%%</td>
</tr>
<tr>
<td><strong>%%matr_mezen.title%%</strong></td>
<td colspan="2">%%matr_mezen.value%%</td>
</tr>';
$fields= array(
"matr_sever.title"=>"matr sever title",
"matr_sever.value"=>"matr sever value"
);
?>
<table>
<?=parseTpl($tpl, $fields);?>
</table>
<?php
$content = "<style>
.plainborder {<br />
border: 1px solid #213A32;<br>
background-color: #213A32;<br>
}<br>
.tableborder {<br>
border: 1px solid #213A32;<br>
background-color: #213A32;<br>
padding: 0;<br>
margin: 0;<br>
}<br>
.tablefill {<br>
border: 1px solid #213A32;<br>
background-color: #213A32;<br>
padding: 6px;<br>
}<br>
.tablepad {<br>
background-color: #4C5D55;<br>
padding: 6px;<br>
}<br>
.tablebasic {<br>
width: 100%;<br>
padding: 0px 0px 0px 0px;<br>
margin: 0px;<br>
border: 0px;<br>
}<br>
.wrapmini {<br>
float: left;<br>
line-height: 1.5em;<br>
width: 26%;<br>
}<br>
.pagelinks {<br>
float: left;<br>
line-height: 1.2em;<br>
width: 35%;<br>
}<br>
.desc {<br>
font-size: 10px;<br>
color: #CDCDCD;<br>
}<br>
.edit {<br>
font-size: 9px;<br>
}
</style>
<div>
LLLLLLLLLLL
</div>
<style>
.plainborder {<br />
border: 1px solid #213A32;<br>
background-color: #213A32;<br>
}<br>
.tableborder {<br>
border: 1px solid #213A32;<br>
background-color: #213A32;<br>
padding: 0;<br>
margin: 0;<br>
}<br>
.tablefill {<br>
border: 1px solid #213A32;<br>
background-color: #213A32;<br>
padding: 6px;<br>
}<br>
.tablepad {<br>
background-color: #4C5D55;<br>
padding: 6px;<br>
}<br>
.tablebasic {<br>
width: 100%;<br>
padding: 0px 0px 0px 0px;<br>
margin: 0px;<br>
border: 0px;<br>
}<br>
.wrapmini {<br>
float: left;<br>
line-height: 1.5em;<br>
width: 26%;<br>
}<br>
.pagelinks {<br>
float: left;<br>
line-height: 1.2em;<br>
width: 35%;<br>
}<br>
.desc {<br>
font-size: 10px;<br>
color: #CDCDCD;<br>
}<br>
.edit {<br>
font-size: 9px;<br>
}
</style>";
echo preg_replace_callback("/<style>(.+)<\/style>/Usi", "styleClean", $content);
function styleClean($matches){
return "<style>".preg_replace("/(<br(\s+)?\/?>)/Usi", "", $matches[1])."</style>";
}
?>