Q:

Regex to get everything between 2 words

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&gt; ***data to capture*** &lt;/li ***more text***

What regex can I use to get everything that is enclosed between li&gt; and &lt;/li ?

A:

Basically it will be like this:
li&gt;(.*?)(?:&lt;/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&gt;(.*?)(?:&lt;\/li)

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

