Wednesday, January 9, 2013

Regex search/replace to insert newlines

I use Kile and Mendeley. Mendeley generates bibtex references, but with no carriage returns, and the carriage returns are apparenly required.

Example:

@article{Baset_2012, place={New York, New York, USA}, ..., pages={1–2}}

I need each of the x={...}, sections to be on a separate line, and it takes a while to do it by hand.

To search/replace, I enter this search criteria:

\}, +([a-zA-Z])
And this replace criteria:

\}, \ \1

The red block is actually representing a CTRL+V of a newline character. Just select an entire empty line, copy and past into the expression. It will look like a blank space.



No comments:

Post a Comment