So I have a lot of text in a text file that acts like a "database" and I need to extract a specific part that starts from a string and ends with another one.
To be more specific, some of the "database" looks like this:
i:24;s:5:"sName";s:12:"adsfasdffdfd";s:7:"iStatus";i:1;s:9:"iPosition";i:0;s:17:"sDescriptionShort";s:29:"<p>test short description</p>";s:16:"sDescriptionFull";s:28:"<p>test full description</p>";
And I need to extract the part between <p> and </p> having as parameter the first i:24, the number being the parameter.
I tried using regexp but no success until now.
Now I know it's not good practice asking for code itself but this time I'm really stuck! Any ideas?
P.S. The file contains strings like this one after another. So I need the regexp to find a i:$a with $a my number and return the content from the first paragraph it encounters.
So what I expect to be returned is: <p>test short description</p>
Considering this should be the first paragraph encountered AFTER i:24
i:24.*?\K<p>[^<]*</p>