Untitled

 avatar
unknown
plain_text
a year ago
917 B
4
Indexable
// Envolver palavras dentro de tags de negrito (<span> com font-weight: 700 ou <strong>)
$texto_limpo = preg_replace('/<((span[^>]*font-weight:\s*700)|(strong))[^>]*>(.*?)<\/(?:span|strong)>/', '<b>$4</b>', $texto);

// Preservar os parágrafos e garantir que eles tenham estilo correto
$texto_limpo = preg_replace('/<p[^>]*>/', '<p style="text-indent: 40px; line-height: 1.4;">', $texto_limpo);

// Remover todas as tags HTML, exceto as de negrito, parágrafos, quebras de linha e a tag <br>, e também remover a tag &nbsp;
$texto_limpo = preg_replace('/<(?!\/?(b|p|br)(?=>|\s.*>))\/?.*?>|&nbsp;/', '', $texto_limpo);

// Envolver o texto limpo em uma div com o estilo desejado
$texto_limpo_com_estilo = '<div style="color: rgb(99, 74, 165); font-size: 16pt; font-family: Arial; text-align: justify; line-height: 1.6; margin-left: 25%; margin-right: 25%;">' . $texto_limpo . '</div>';

echo $texto_limpo_com_estilo;
Editor is loading...
Leave a Comment