Page 1 of 1

Find/Replace Strings don't work!

Posted: 2009-10-28 05:51:08
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

Re: Find/Replace Strings don't work!

Posted: 2009-10-28 08:39:23
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.

Re: Find/Replace Strings don't work!

Posted: 2009-10-28 08:42:12
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

Re: Find/Replace Strings don't work!

Posted: 2010-03-09 03:34:35
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

Re: Find/Replace Strings don't work!

Posted: 2010-03-09 03:38:59
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.

Re: Find/Replace Strings don't work!

Posted: 2010-03-09 04:02:51
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.

Re: Find/Replace Strings don't work!

Posted: 2010-03-09 05:31:21
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