Page 1 of 1

Search and Replace Problem -- TextPad 4.4.1

Posted: Mon Apr 02, 2001 10:41 pm
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.

Re: Search and Replace Problem -- TextPad 4.4.1

Posted: Tue Apr 03, 2001 2:48 am
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.

Re: Search and Replace Problem -- TextPad 4.4.1

Posted: Wed Apr 04, 2001 3:31 pm
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...

Re: Search and Replace Problem -- TextPad 4.4.1

Posted: Wed Apr 04, 2001 4:33 pm
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.

Re: Search and Replace Problem -- TextPad 4.4.1

Posted: Wed Apr 04, 2001 4:36 pm
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.

Re: Search and Replace Problem -- TextPad 4.4.1

Posted: Tue Apr 24, 2001 2:14 pm
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 :)