How can I delete certain lines with specific extensions in Notepad++?

I'm trying to use Regex to delete certain lines from my file right now the file is just a bunch of links that have certain endings (.unitypackage, .anim, .png). I'm trying to remove all lines that have the ending .anim but its also deleting lines that contain the word Animation instead of the exact ending .anim.

I'm currently using (?-s)^.*.anim.*\R and replacing with \1\n. I have Match case enabled, Wrap around enabled, and am using Regular expression.


Solution 1:

A dot in regex matches every character, so you have to escape it with a backslash. I don't have access to Notepad++ right now, but an easy solution is to find ^.*\.anim$ (the $ indicates the end of the line) and replace it with nothing. The disadvantage may be that this leaves empty lines instead of removing them.

An advanced option is to find \n.*?\.anim\r instead. The ? is there to make sure the \n of the previous line is matched, otherwise it will match more than one line. You do need to check the '. matches newline' option:

enter image description here

This is the result:

enter image description here