Search code examples
regexnotepad++bioinformaticsfasta

Find any letter at the end of a line, delete line break without replacing the target


I'm trying to collapse several lines of letters to a single one.

Example

>8445125
VSSSDEQPRPRRS
RNQDRQHPNQNRP
VLGRTERDRNRRQ
FGQNFLRDRKTIA


>8445125
VSSSDEQPRPRRSRNQDRQHPNQNRPVLGRTERDRNRRQFGQNFLRDRKTIA

I've tried regex Find [A-Z]\n Replace with blank. Problem is that it would delete the S, P Q and A that are at the end of each line. I need to do this without deleting those letters.

In a given file, I would have >1000 of the above.


Solution

  • You can change your regular expression to the following. The \K escape sequence resets the starting point of the reported match and any previously consumed characters are no longer included.

    Find: [A-Z]\K\n