Find/Replace Strings don't work!

Everything related to our flagship word processor.
Post Reply
User avatar
Matze
Posts: 170
Joined: 2004-12-14 07:54:49
Location: Düsseldorf Germany
Contact:

Find/Replace Strings don't work!

Post by Matze »

Hello nise people.

I've got a problem replacing a found string.

this is the text I am searching for:
one word, which can be "one", "two", "three"(return)
(return)
"four"

Findstring in PFpro is: ^((one)|(two)|(thre))(\n\n)(four)

I want to make it two more returns (and it is not possible just to search for tow returns and replace them, cos only some have to be replaced)
So I have my replace string: \1\2\n\n\3

F/R finds the string. If it finds "one" and all the rest it replaces to:
oneone(return)
(return)

if it finds "two" and the rest it replaces to:

two(return)
(return)
two

if it finds "three" and the rest, it replaces to:
three(return)
(return)

please help me with the correct replace string!!

Best regards, Matze

Groucho
Posts: 497
Joined: 2007-03-03 09:55:06
Location: Europe

Re: Find/Replace Strings don't work!

Post by Groucho »

Hi, Matze.

I don't know if I grasped that alright. I wrote the following in an empty document:

Code: Select all

one

four
two

four
seven

four
three

four
Then I ran the following PowerFindPro formula:

Code: Select all

Find: (one|two|three)\n\n(four)
Replace: \1\n\n\n\n\2
And I got this:

Code: Select all

one



four
two



four
seven

four
three



four
Is it what you are looking for?

Cheers, Henry.

User avatar
phspaelti
Posts: 1126
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Find/Replace Strings don't work!

Post by phspaelti »

Matze,

why are you placing parentheses around the "(one)" etc. ? You don't need those. Just make it

^(one|two|three)(\n\n)(four)

But since you don't want to touch the (one|two|three) and (four) you could also use "look ahead" and "look behind" (in the select menu). Then you can rewrite the whole thing as:

^(?<=one|two|three)(\n\n)(?=four)

Now the find will only select the returns so the replacement is just

\1\n\n or \n\n\n\n

hope that helps
philip
philip

User avatar
Matze
Posts: 170
Joined: 2004-12-14 07:54:49
Location: Düsseldorf Germany
Contact:

Re: Find/Replace Strings don't work!

Post by Matze »

Hi Henry, hi Philip,

I have to apologize that I have forgotten to thank you for your help! I beg your pardon! Because I seldomly use NWP as intense as I did use NW6.5 I am not visiting the forums as much as I did way back in the Dartmouth area.

I hope you all old dartmouth folks are doing well btw, best Matze

User avatar
Matze
Posts: 170
Joined: 2004-12-14 07:54:49
Location: Düsseldorf Germany
Contact:

Re: Find/Replace Strings don't work!

Post by Matze »

by the way I am writing on this topic. Someone here, who can explain, why the heck nisus has changed that old "replace and find" button of NW 6.5 to "search and replace" in NWP? This simply makes no sense at all to me. This way I can't control no more whether I really should replace what I have found.

Kino
Posts: 400
Joined: 2008-05-17 04:02:32

Re: Find/Replace Strings don't work!

Post by Kino »

Matze wrote:Someone here, who can explain, why the heck nisus has changed that old "replace and find" button of NW 6.5 to "search and replace" in NWP?
Looks like a German localization issue (Suchen & Ersetzen). It is “Replace & Find” in the English interface of NWP and should be translated into “Ersetzen & Suchen” like the same button in Apple applications, e.g. Mail.

User avatar
Matze
Posts: 170
Joined: 2004-12-14 07:54:49
Location: Düsseldorf Germany
Contact:

Re: Find/Replace Strings don't work!

Post by Matze »

In fact, Kino! The bloody button-naming has fooled me. But I know, that at least in previous versions it also did behave the wrong way, so I never used it again and missed that it now behaves as it should, even with wrong naming.
Thanks for making me trying it again ;-) Matze

Post Reply