I have a text file with information about a recording, including track numbers and names, and I want to delete all the other text except the track number and track names. For example the text file looks like this:
text text text text
text text text text text text text text
text text text text text text text text text text text text
text text text text
text text text text text text text text
text text text text
text text text text text text text text text text text text text text text text
text text text text text text text text
text text text text
d1t01 - trackname
d1t02 - trackname
d1t03 - trackname
d1t04 - trackname
d1t05 - trackname
d1t06 - trackname
d1t07 - trackname
d1t08 - trackname
d1t09 - trackname
d1t10 - trackname
d1t11 - trackname
text text text text
text text text text text text text text
text text text text text text text text text text text text
text text text text
text text text text text text text text
text text text text
text text text text text text text text text text text text text text text text
text text text text text text text text
text text text text
I want to be left with just this:
d1t01 - trackname
d1t02 - trackname
d1t03 - trackname
d1t04 - trackname
d1t05 - trackname
d1t06 - trackname
d1t07 - trackname
d1t08 - trackname
d1t09 - trackname
d1t10 - trackname
d1t11 - trackname
I figured out how to match the beginning of the line with this regex:
d[0-9]+t[0-9]+[0-9]+ -
But I can't figure out how to delete the rest of the "text" and only leave those lines. I also need it to delete the "returns" and not be left with any blank lines in the text file.
Thank you!
Using Regex to find and replace text in Notepad++ In all examples, use select Find and Replace (Ctrl + H) to replace all the matches with the desired string or (no string). And also ensure the 'Regular expression' radio button is set.
Step 1 - Match lines. Find dialog > Mark tab, you can bookmark lines that match.
Step 2 - Remove lines bookmarked OR Remove lines not bookmarked. Search > Bookmark > Remove Unmarked Lines or Remove Bookmarked lines
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With