Page 1 of 1

Find and replace line breaks

Posted: Tue Apr 19, 2011 10:05 am
by Julesomega
I am trying edit text but I have no understanding of 'codes' or POSIX

My text has the form:
(text1)

A: (more text1)
(text2)

A: (more text2)
and I would like to find and replace the two line breaks to give
(text1): (more text1)
(text2): (more text2)

I have seen similar topics which require POSIX regular expression syntax, so I tried to SEARCH for [\n\nA:] and REPLACE with [:] both with and then without POSIX selected but it 'cannot find literal string \n\nA:'

I am running WinXP btw

Posted: Tue Apr 19, 2011 11:12 am
by ben_josephs
You didn't select Regular expression.

TextPad's regex recogniser doesn't treat a backslash in a character class ([...]) as an escape character, so your regex won't work. Try
Find what: \n\nA:
Replace with: :

[X] Regular expression

Replace All
This regex works with either "Posix" or default regex syntax.

Posted: Tue Apr 19, 2011 8:12 pm
by Julesomega
Many thanks Ben, that works a treat
So, I needn't have bothered with Editor Preferences, it's all there in the Find/Replace dialog box! One day I'll learn a lot more of the tricks 8cD