php - How to remove a number enclosed between html tags -
i have string, below string:
$var = 'it text<nobr><font color="#176200">﴿3﴾</font></nobr>';
now want below output:
$var = 'it text';
note: number of 3
changeable.
how can ?
instead of replacing number , tags null can first part (the string) following regex :
^[^<]*
see demo
edit:
and can replace result of above code in main string, this:
$var = 'it text<nobr><font color="#176200">﴿3﴾</font></nobr>'; $sec_part = preg_replace('/^[^<]*/','', $var); $result = str_replace($sec_part,'',$var); echo $result;
output:
it text
Comments
Post a Comment