Question: I have a series of strings in a file of the format:

```
>HEADER_Text1
Information here, yada yada yada
Some more information here, yada yada yada
Even some more information here, yada yada yada
>HEADER_Text2
Information here, yada yada yada
Some more information here, yada yada yada
Even some more information here, yada yada yada
>HEADER_Text3
Information here, yada yada yada
Some more information here, yada yada yada
Even some more information here, yada yada yada

```

I am trying to find a regex pattern which will remove the new line characters below the `>` character in between the next `>` character. So the final result would look like:

```
>HEADER_Text1
Information here, yada yada yada Some more information here, yada yada yada Even some more information here, yada yada yada
>HEADER_Text2
Information here, yada yada yada Some more information here, yada yada yada Even some more information here, yada yada yada
>HEADER_Text3
Information here, yada yada yada Some more information here, yada yada yada Even some more information here, yada yada yada

```

Does anyone know how I can come up with a regex pattern to do this?

Side note: This format is common in computational science as a FASTA format.

Thanks!

Answer: 
As noted in the comments, your best bet is to use an existing FASTA parser. Why not?

Here's how I would join lines based on the leading greater-than:

```
def joinup(f):
    buf = []
    for line in f:
        if line.startswith('>'):
            if buf:
                yield " ".join(buf)
            yield line.rstrip()
            buf = []
        else:
            buf.append(line.rstrip())
    yield " ".join(buf)

for joined_line in joinup(open("...")):
    # blah blah...

```
this should also work.

sampleText=""">HEADER\_Text1
Information here, yada yada yada
Some more information here, yada yada yada
Even some more information here, yada yada yada

> 
> HEADER\_Text2
>  Information here, yada yada yada
>  Some more information here, yada yada yada
>  Even some more information here, yada yada yada
>  HEADER\_Text3
>  Information here, yada yada yada
>  Some more information here, yada yada yada
>  Even some more information here, yada yada yada""""
> 
> 
> 

cleartext = re.sub ("\n(?!>)", "", sampleText)

print cleartext

> 
> HEADER\_Text1Information here, yada yada yadaSome more information here, yada yada yadaEven some more information here, yada yada yada
>  HEADER\_Text2Information here, yada yada yadaSome more information here, yada yada yadaEven some more information here, yada yada yada
>  HEADER\_Text3Information here, yada yada yadaSome more information here, yada yada yadaEven some more information here, yada yada yada
> 
> 
>