E
E
Eugene2018-01-29 14:29:31
Sublime Text
Eugene, 2018-01-29 14:29:31

Sublime Text 3 - how to remove all lines nested in a specific tag?

Given: a large xml file with metadata, in which there are extra tags with different content.
Task: remove from this file all lines starting and ending like this:
<genre>%текст%</genre>
I am aware that ST3 has a search function that allows you to delete and edit multiple lines at once by keywords. But how to implement this if there is <genre></genre>,different nested text inside the tag?
Is it possible somehow to highlight all tags <genre></genre>including nested text?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2018-01-29
@free_gen

Found a solution.
ctrl+F -> select icon with an asterisk (search by regular expressions), if you need to remove all tags <genre></genre>with nested text, enter <genre>(.+?)</genre>
UPD. HELP
this formula works great, but if there are hyphens in the text, then the line is completely ignored. what else can be added to enable line breaks?

A
alex1nd, 2021-04-21
@alex1nd

in notepad++
<genre.*<\/genre>
in regular expression mode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question