mardi 26 avril 2016

regexp read backwards

I have a html string

<li>bmasdas asmdasmdamsd admasmams asmdamsdma asmdamsdasm </li> 
<li> asdmams sdasdasmdamsdma asdmsasdaddamsdasm </li> 
<li> dsadasdasdas TARGET dasdasdsa</li>

If i try to capture "li" string which has word Target in it I am using following code:

<li.*?TARGET.*?\/li>

It works fine when you consider regexp stops with the last '<\li>, doesn't go ahead, however i am trying to find a way it would not go and read all other lines with <'li> before TARGET. Is there any way I can define this?

Aucun commentaire:

Enregistrer un commentaire