Remove lines ending with a specific format in Notepad++
Solution 1
To remove lines ending with .vmt
, use Search and Replace and select the Regular Expression option. Give the regular expression as
[^%]*.vmt
This will replace all lines that end with .vmt
.
Similarly, to replace lines ending with _exponent.vtf
, use:
[^%]*_exponent.vtf
as the regular expression.
The regular expression [^%]*
means
match all characters other than %
.
Solution 2
Similar to what Raam answered, but with the regular expressions
^.*\.vmt"$
^.*_exponent\.vtf"$
The dot before the extension should also be escaped with backslash.
^ marks the beginning of a line.
$ marks the ending of a line.
Solution 3
Use Find to mark all lines
Ctrl + F to open the Find screen
Go to the "Mark" Tab
Check "Bookmark line" option
Check the Regular expression option
Use
vmt$
as regex to find all lines ending with "vmt".$
is the regex anchor that matches the end of a row.Press "Mark All"
Go to the "Search" menu, "Bookmarks ==> Remove Bookmarked lines"
Similar for your other case, you can use exponent\.vtf
as regex. To match a literal "." with regex, you have to escape it \.
, because it is a special character in regex.
Solution 4
I don't know if regex has changed since, but as for me, the working regular expression was:
(.*).vmt$
(.*) select the whole line before the .vmt extension
Related videos on Youtube
user1685565
Updated on September 18, 2022Comments
-
user1685565 almost 2 years
I've got a simple array in Notepad++:
bla.vmt" bla.vtf" bla_exponent.vtf"
I want to get rid of the lines ending with
.vmt
and_exponent.vtf
. -
stema over 11 yearsSince Notepad++ 6.0 PCRE regex is used, so
[^%]
will also match newline characters. This solution will match far too much and even anchors to the end of the row are missing.