Friday, 16 August 2019

Notepad++ Deleting everything apart from 40 variables, putting them on their own line, combining regex


I am in Notepad++. I have the following data embedded in a large html file. I want to get the variables before the at the end of the lines, onto their own lines by themselves so the output is:


00891906 1.12.13 30.11.14 30.11.14 Company Accounts Private Limited Company


etc.


There is more data but if I can get regex to do this, I will be able to work the rest out. Thanks. Once working, I will use the Batch Replace in a directory and do this to a number of txt files.


            `


00891906



1.12.13
30.11.14
30.11.14
Company accounts
Private Limited Company
FY
true
false
true
false
true
false
false
Ordinary
1.00000




iso4217:GBPiso4217:USD`

Answer



Based on the example you gave, the following regex will work:


Find what: .+?(<.+?>)(.+?)(<.+?>)


Replace with: \2\r


This will give the following result with your data:


VARIABLE 1
VARIABLE 2
VARIABLE 3
randomrandom random randomrandom random randomrandom random random randomrandom random randomrandom random

Only the last line will not be filtered out, but that can be manually removed.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...