How to exclude an HTML tag in regex search -


i'm using powergrep find instances of these:

block 1:

<td class="danish">kat <?php audiobutton("../../audio/words/dog","dog");?></td> 

but there instances of these among files:

block 2

<td class="danish">kat</td> <td><?php audiobutton("../../audio/words/dog","dog");?></td> 

i want find block 1 only, not block 2.

i've tried using (?!), in

.*<td class(.*?)>(.*)(?!</td>) .*<\?php audiobutton\("(.*)/.*",".*"\);.*\?></td>  

can somehow exclude </td> tag search, block 2 ignored?

i not sure why want match first cell tag only, perform can try:

<td[^>]*>\s*(?:.(?!</td>))+\s*<\?php audiobutton\("[^"]*/(.+?)","(.*?)"\);.*?\?>.*?</td> g flag.

see working here: https://regex101.com/r/ti4rl4/1

[edit]

you can see replacement of dog cat here: https://regex101.com/r/ti4rl4/2

it may not perfect, since question bit vague, works. if need refine bit or adjust or need bit of explanation can ask me!


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -