Need help with PowerFind

Everything related to our flagship word processor.
Post Reply
CarolJR
Posts: 7
Joined: 2013-07-02 20:30:11
Location: Greendale, WI

Need help with PowerFind

Post by CarolJR »

I'm trying to learn PowerFind but having a hard time understanding the manual (and the error message I'm getting). I want to replace any comma+space that is preceded by either a word, a double quote, or a period and is followed by any digit. I'll be replacing the comma+space with a tab. What I have so far is this (don't laugh):

, (PrecededBy()(AnyWord)(Or)(Any Double Quote)(Or).())(FollowedBy()(AnyDigit)())

I get an error message about an invalid look-behind expression, whatever that means. Anybody know how to write the string of commands correctly? I also tried putting the comma+space between the precededby and followedby.

I don't suppose there are any video tutorials for some of these advanced techniques?

Cheers,
Carol
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Need help with PowerFind

Post by phspaelti »

Hello Carol
you almost have it right. There are two things:
  • The first is you should (probably) put the "Preceded by" before the ", "
  • The more crucial problem, which would be very difficult to figure out is that "Preceded by" does not like expressions with repetitions. "Any Word" looks innocent enough, but actually contains a repetition inside it. (It is any number of word characters.) So instead of using "Any Word" just use "Any word character".
The completed pattern should look like this:
Find comma.jpg
Find comma.jpg (70.17 KiB) Viewed 7885 times
philip
CarolJR
Posts: 7
Joined: 2013-07-02 20:30:11
Location: Greendale, WI

Re: Need help with PowerFind

Post by CarolJR »

Thank you! That seems to find what I want to replace, but something unexpected happened. It replaced the comma+space with dot leaders instead of a tab, even though I put the tab metacharacter in the replace field.

Cheers,
Carol
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Need help with PowerFind

Post by phspaelti »

Not sure, but here is what I suspect:
Perhaps your replace expression had a ruler attached with a tab set with a leader, and the replace was set to replace with attributes...?

Or did it insert actual dots or an ellipsis (…) ?
philip
CarolJR
Posts: 7
Joined: 2013-07-02 20:30:11
Location: Greendale, WI

Re: Need help with PowerFind

Post by CarolJR »

Actual dots. I selected the tab character from within the gear menu, so I don't know why it would have anything attached. Also, I discovered that anywordcharacter doesn't work, either, because it picks up digits not just letters.

Perhaps I need to start from square one. I'm trying to change lines like these:

“Old King”, 50
Aaron C. Usher, 41
Aaron Gaylord, 31, 55, 56
Hhezekiah Usher, Jr., 41

to these (* is a tab):

“Old King”*50
Aaron C. Usher*41
Aaron Gaylord*31, 55, 56
Hhezekiah Usher, Jr.*41

I need tab-delineated fields in order to import the entries into an indexing program, so I need to separate the name from the page references usung a tab. I will later invert the names.
Cheers,
Carol Roberts, book indexer
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Need help with PowerFind

Post by martin »

CarolJR wrote:Actual dots. I selected the tab character from within the gear menu, so I don't know why it would have anything attached.
I'd guess that the document text you're modifying already has a ruler/paragraph style that includes some leader tab stops. You can verify this by looking up at the ruler and checking if any of the tab stop makers have three little dots above them. You could either remove such a leader tab stop, or add another non-leader tab stop that affects the tab characters inserted by your Replace All.

However, now that I'm thinking about this, it seems you might be modifying an automatically generated index? If so, you shouldn't need to mess with this kind of replacing. NWP's index styles can be altered using the menu Tools > Index > Configure Index Styles so that the generated indexes use whatever spacing/delimiter characters you like.
I discovered that anywordcharacter doesn't work, either, because it picks up digits not just letters.
If you're just writing in English with Latin characters you could use this expression instead:
powerf.png
powerf.png (21.36 KiB) Viewed 7869 times
CarolJR
Posts: 7
Joined: 2013-07-02 20:30:11
Location: Greendale, WI

Re: Need help with PowerFind

Post by CarolJR »

No, i'm not using any kind of generated index, just hand-typed index entries. I thought of another way—squeezing the spaces out between the page references, since my indexing software automatically puts them back in, then replacing the remaining comma+space with a tab—but that approach isn't great because of all the names that include a comma, e.g., anything with "Jr." It turns out that the funky tabs/dots won't be a problem, because my indexing software is correctly reading those as tabs.

So. I will go try your new suggestion and report back.
Cheers,
Carol Roberts, book indexer
CarolJR
Posts: 7
Joined: 2013-07-02 20:30:11
Location: Greendale, WI

Re: Need help with PowerFind

Post by CarolJR »

Brilliant! That worked perfectly, and yes I'm going to save the expression. Wow!!! I did take a closer look at ruler and found some sneaky little dots there. I don't know how to change that preference, so I used brute force, selecting all, dragging the offending tab off the ruler, and putting in a normal one. I'm so grateful for your help. You have no idea how many hours of work you saved me.

I think I now have the courage to experiment a bit to see if I can invert the names. You're a peach!
Cheers,
Carol Roberts, book indexer
CarolJR
Posts: 7
Joined: 2013-07-02 20:30:11
Location: Greendale, WI

Re: Need help with PowerFind

Post by CarolJR »

Oops, just realized there were 2 of you helping me. Thank you both!!!
Cheers,
Carol Roberts, book indexer
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Need help with PowerFind

Post by martin »

Glad you got everything working, and I'm very happy to have helped! I can assume Philip was happy to help too, since he's so often giving out great advice and expertise on our forums. We're lucky to have such a helpful community.
CarolJR
Posts: 7
Joined: 2013-07-02 20:30:11
Location: Greendale, WI

Re: Need help with PowerFind

Post by CarolJR »

Indeed. This has been a very encouraging experience. I'll have to explore the bells and whistles more.
Cheers,
Carol Roberts, book indexer
Post Reply