Suggestions for how to approach this problem?

John Salerno johnjsal at NOSPAMgmail.com
Wed May 9 11:36:51 EDT 2007


John Salerno wrote:

> So I need to remove the line breaks too, but of course not *all* of them 
> because each reference still needs a line break between it.

After doing a bit of search and replace for tabs with my text editor, I
think I've narrowed down the problem to just this:

I need to remove all newline characters that are not at the end of a
citation (and replace them with a single space). That is, those that are
not followed by the start of a new numbered citation. This seems to
involve a look-ahead RE, but I'm not sure how to write those. This is
what I came up with:


\n(?=(\d)+)

(I can never remember if I need parentheses around '\d' or if the + 
should be inside it or not!



More information about the Python-list mailing list