RegEx Remove the Last Match Only
-
</td> </td <td> </td <p>ITEMS</p> </td> </td <td> </td> <td> </td <p>INDEX</p> </td> </td </tr> </tr <br> <br>Is it possible to create a RegEx code to capture the last </td ?
My current code is
\ </td.*?It matches the first td as well, such as
</td> </tdThanks in advance!
-
Yes, by taking advantage of the greediness of
*symbol. Try the following:Search: (?s).*\K</td.*? Replace: [leave empty]Put the caret at the very beginning of the document, select the
Regular Expression modeand click only onReplace All.Have fun!
-
There’s a technique to find the last match in a file, presented HERE. You might give that a try.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login