2

I am trying to get through a lot of content and to extract some data from it. Therefore I need to pick the information between 2 set of characters.

It looks like this

***some text*** li> ***data to capture*** </li ***more text***

What regex can I use to get everything that is enclosed between li> and </li ?

Spearfisher
  • 8,445
  • 19
  • 70
  • 124

1 Answers1

1

Basically it will be like this:

li>(.*?)(?:</li)

Depending on your language environment, certain characters may need to be escaped or the way of retrieving the matched string may differ. Typically you would need to escape / by prepending a backslash, resulting in this new version:

li>(.*?)(?:<\/li)

Here's a live demo: https://regex101.com/r/zV4uN6/1

Eirik Birkeland
  • 588
  • 5
  • 11
hata
  • 11,633
  • 6
  • 46
  • 69