Search and Replace Problem -- TextPad 4.4.1

General questions about using TextPad

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

Post Reply
Jacob Carpenter

Search and Replace Problem -- TextPad 4.4.1

Post by Jacob Carpenter »

When performing a Search + Replace (via the 'Replace' dialog), one is able to search for a string containing an embedded newline (\n). However, the 'Replace' button appears to act like the 'Find Next.' The only way to make a replacement for text containing a newline is with the 'Replace All' button, unfortunately not always the best option.

Example:

1) Create a document [Alt + F; N] containing this text: "
hello
world
," minus the punctuation marks

2) Open the "Replace" dialog [F8]; enter "hello\n" in the 'Find what:' box (again, without punctuation), and enter "goodbye " in the 'Replace with:' box

3) 'Find [Next]' it

4) Attempt to 'Replace' it

5) Try 'Replace All'

Thank you for consistently providing such a quality product, and I have no doubt this will be repaired expeditiously.

Jacob.
Brian

Re: Search and Replace Problem -- TextPad 4.4.1

Post by Brian »

I'm a new user. I just noticed this and didn't know if this was the default action. :-\

Needless to say, I'm glad it's not.
Paul Havemann

Re: Search and Replace Problem -- TextPad 4.4.1

Post by Paul Havemann »

One way around this is to perform a 'Replace All' operation on a block of selected text. It's possible to write a simple macro to do the replace, assuming you've already selected the block of text.

I suppose you could even include the selection process in the macro, assuming two CRs between paragraphs...
Jacob Carpenter

Re: Search and Replace Problem -- TextPad 4.4.1

Post by Jacob Carpenter »

True, true.

Yet another work-around would be to simply perform a global search + replace on all the embedded newlines, replacing them with some high-ascii character (or string of characters) that you know does not appear in your document. Then perform your search and replace (which by the way will actually allow you to 'remember' [via the "(" ")" meta-characters in POSIX syntax, or "\(" "\)" for default syntax] the pseudo-newlines) as per usual. And finally, replace all the pseudos with the real newline character.

However, as I don't generally include the newline in my regex-es [regular expressions], it's not a big issue to me. Thank you for the assistance offered, but the primary reason I posted this issue here was to alert the powers that be -- powers that be, take note.

Jacob.
Jacob Carpenter

Re: Search and Replace Problem -- TextPad 4.4.1

Post by Jacob Carpenter »

True, true.

Yet another work-around would be to simply perform a global search + replace on all the embedded newlines, replacing them with some high-ascii character (or string of characters) that you know does not appear in your document. Then perform your search and replace (which by the way will actually allow you to 'remember' the pseudo-newlines and combine them with repetition operators) as per usual. And finally, replace all the pseudos with the real newline character.

However, as I don't generally include the newline in my regex-es [regular expressions], it's not a big issue to me. Thank you for the assistance offered, but the primary reason I posted this issue here was to alert the powers that be -- powers that be, take note.

Jacob.
Michael Ankenbrandt

Re: Search and Replace Problem -- TextPad 4.4.1

Post by Michael Ankenbrandt »

The workarounds certainly are valid, but the Replace Next function is VERY handy for testing. Is there any idea when this bug might be addressed? I am starting to get calls from hospital Textpad users questioning "why does this not work", and it consumes time I could spend actually being productive :)
Post Reply