I have a document containing a series of strings between hundreds of []
and I want to highlight the strings and copy the information into a spreadsheet.
I have attempted using the Find
tool but cannot figure out the regex expression
The final goal of this would be to be able to copy the information in one go into a new file, or highlight it and copy into an excel spreadsheet.
Text file something like:
>X_343435353.3 words like foo bar [Wanted text]
TGATGATGCCATGCTAGCCATCGACTAGCGACTAGCATCGACTAGCATCAGCTACGACTAGCATCGACTACGA
>XP_543857836.3 other information [Text that I want]
TAGCATCGACTAGCTACTACCTGAGCGAGAAATTTTGGCTATCGACATCGACTATCGAGCACAGCTAGGAATT
>NP_3843875938.2 interesting words [Third desired text]
ATCGCATAGCGCGCTTAGAAGGCCTTAGAGGCATCATCTATCGAGCGACGATATCGCGAGGCAGCGCTATACC
The ouput I desire is as follows:
Wanted text
Text that I want
Third desired text
I am not sure if it is possible to do this in Notepad++ or if you need to use a cmd/shell tool to do it. I am using a Windows 10. The thought was that it may be possible to highlight all of the desired text with a regex that can then be copied elsewhere.
To match just the text and not the brackets:
(?<=\[).*?(?=\])
Example:
To delete everything in a document and leave just the wanted text on each line:
.*?\[
, Select regular expression and .
matches newline.\]
, Select regular expression and .
matches newline.Result:
Wanted text
Text that I want
Third desired text
You'll need to delete the last bit after the final match (if any) once the macro completes.