Jump to content

Recommended Posts

First, here is the text I am working off of:

 

<div id="block-menu-menu-top-menu" class="block block-menu">
  <h2>Top Menu</h2>

  <div class="content">
    <ul class="menu"><li class="leaf first dhtml-menu "><a href="/about_us" title="" id="dhtml_menu-264-1">教室案内</a></li>
<li class="leaf  dhtml-menu "><a href="/courses" title="" id="dhtml_menu-265-1">コース</a></li>
<li class="leaf  dhtml-menu "><a href="/course_fees" title="" id="dhtml_menu-267-1">コース料金</a></li>
<li class="leaf  dhtml-menu "><a href="/jidou_eiken" title="" id="dhtml_menu-266-1">児童英検</a></li>
<li class="leaf  dhtml-menu "><a href="/galleries" title="" id="dhtml_menu-268-1">ギャラリー</a></li>

<li class="leaf  dhtml-menu "><a href="/testimonials" title="" id="dhtml_menu-270-1">生徒の声</a></li>
<li class="leaf last dhtml-menu "><a href="/access" title="" id="dhtml_menu-269-1">お問合せ・アクセス</a></li>
</ul>  </div>
</div>

 

I'm trying to pull out the <ul> tags, and everything in between, using this:

 

preg_match('/<ul\b[^>]*>(.*?)<\/ul>/i', $text, $matches);

 

For whatever reason, it's not working. I can grab the opening <ul> tag, or the closing </ul> tag by themselves, but if I try to grab the content in between, I get nothing.

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/189418-why-isnt-this-regex-working/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.