Jump to content

Preg question with regex not working


pianoparadise

Recommended Posts

I am trying to get $match[1] to have '<li>AAAAA' stored, but the code is not working. How can I fix this?

 

 

<?php
$data='
<ul>
<li>AAAAAA
<ul>
<li>BBBBB</li>
</ul>
</li>
</ul>';

$regex = '/\<ul\>(.*)\<ul\>/i';

preg_match($regex,$data,$match);

echo $match[1];
  var_dump($match);

?>

Link to comment
https://forums.phpfreaks.com/topic/122054-preg-question-with-regex-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.