0

i need help to extract all the text inside each tag of the following html using regex or any other method each on separate line . i am using PHP .

<p><strong>Ingredientes (para 700gr aprox)</strong></p>
<p>Se necesitará papel de aluminio para envolver</p>
<p><strong>Secos</strong></p>
<ul>
<li>2 1/4 taza de harina de gluten</li>
<li>1/2 taza de levadura nutricional</li>
<li>1 taza de pan molido</li>

<li>2 1/2 cdtas de sal</li>
<li>1 cdta de comino</li>
<li>1/2 cdta de pimienta negra molida</li>
</ul>
<p><strong>Líquidos</strong></p>
<ul>
<li>2 1/4 tazas de agua fría</li>
<li>2 cdas de caldo de verduras</li>
<li>2 cdas de aceite de oliva</li>
<li>2 cdas de sillao o salsa de soja</li>

<li>2 cdtas de ajo molido</li>
</ul>
<p><strong>Preparación</strong></p>

if i put all lines of above html in a single line what will be the change in regex/other method ??

thanks in advance

Quazi Marufur Rahman
  • 2,603
  • 5
  • 33
  • 51

1 Answers1

3

Try running strip_tags on the string.

Example:

$text = "<p>Some <strong>text.</strong></p>";
$strippedText = strip_tags($text);
echo($strippedText);

Output:

Some text.

mopsled
  • 8,445
  • 1
  • 38
  • 40