-1

I want to match this HTML tag using Regex and get the inner text for <ul> tag

<ul class="test">

<li>Data</li>
<li>Data</li>
<li>Data</li>

</ul>

given that <ul class="test"> is fixed ,, I want to match the inner data of this tag

Mohamed Kamal
  • 1,587
  • 2
  • 13
  • 16

1 Answers1

1

You should try this if you're sure you won't have ul tag inside your ul tag:

/<ul class="test">(.*?)<\/ul>/

If, however, you do have nested tags, well, it'd depends on what language you're using. Eg, in PHP:

/<ul.*?>((?:(?R)|.)*?)<\/ul>/
Loamhoof
  • 8,293
  • 27
  • 30