Find and replace line breaks

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Julesomega
Posts: 5
Joined: Tue Mar 03, 2009 10:07 pm
Location: Stockport UK

Find and replace line breaks

Post 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
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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.
Julesomega
Posts: 5
Joined: Tue Mar 03, 2009 10:07 pm
Location: Stockport UK

Post 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
Post Reply