Limiting Search to Body or Notes . . .

Everything related to our flagship word processor.
Post Reply
goldste4
Posts: 98
Joined: 2010-02-22 15:06:48

Limiting Search to Body or Notes . . .

Post by goldste4 »

Hello All,

Today I had to do a simple search for all tab characters in the body of a document (to replace them with nothing), but wanted to leave the tab characters in the footnotes alone. After hunting around a bit, I could not discover a way to restrict the Find and Replace to just the body (I'm thinking of Wordperfect here, which allowed one to include or exclude search of footnotes and headers with a click of a menu option in the find window). I tried selecting just the body and then selecting "in Selection", but to no avail. Any suggestions or something I've simply overlooked?

On a related note, it would be nice if NWP's find and replace gave a warning if more than a certain number of items were going to be replaced (Wordperfect also had this feature). After (twice!) running a poorly constructed search term that accidentally replaced every space character in a long document, I would have appreciated being warned that 9000+ items were going to be replaced! I would then have the opportunity to cancel (although the undo feature worked fine). I realize that this feature would just be there to protect me against my own ineptitude.

Thanks,
Josh
rmark
Official Nisus Person
Posts: 428
Joined: 2003-02-11 10:49:05
Location: Solana Beach, CA
Contact:

Re: Limiting Search to Body or Notes . . .

Post by rmark »

Hello Josh,

I'm sorry you experience difficulties with Nisus Writer Pro.

Odd, however, it (replacing the tabs only in the selection) works fine for me. I'm curious if anyone else can reproduce this.
Write On!
Mark Hurvitz
Nisus Software Inc.
goldste4
Posts: 98
Joined: 2010-02-22 15:06:48

Re: Limiting Search to Body or Notes . . .

Post by goldste4 »

Hello All,

I've attached a page or so from the file that is giving me problems, for anyone who is curious (there are tabs in every footnote, and one tab in the body). Here is what I tried:
  • selection point in body of text
  • hit Command-A to select body (only body of text is selected, note text is not)
  • call up the find and replace window, and select "In Selection" for "Where"
  • search parameters: find (tab) and replace (nothing)
  • click Replace All
Result: the tabs in both the body and the notes are replaced. I've tried running the find and replace under Normal Find, and PowerFind and PowerFind Pro, all with the same result.

When I try running the find and replace with only all the notes selected, I get a different result: only the tab in the first note is replaced, and all the other notes are untouched, as is the body of the text.

Hope that helps.
Josh
Attachments
TabTest.rtf.zip
(5.97 KiB) Downloaded 460 times
Kino
Posts: 400
Joined: 2008-05-17 04:02:32

Re: Limiting Search to Body or Notes . . .

Post by Kino »

goldste4 wrote:After hunting around a bit, I could not discover a way to restrict the Find and Replace to just the body (I'm thinking of Wordperfect here, which allowed one to include or exclude search of footnotes and headers with a click of a menu option in the find window). I tried selecting just the body and then selecting "in Selection", but to no avail.
Unfortunately Replace in Selection does not work because, even when only the main body is selected, you cannot exclude other text objects (notes, headers, footers) which are so-to-say attached to it.

I do hope the Find panel will have something enabling you to limit the find/replace scope per text object in a future version of NWP. In the mean time, try the following macros. They read Find/Replace strings and options from the Find panel.

Code: Select all

### Replace All in Main Body ###
$find = Read Find Expression
$replace = Read Replace Expression
$options = Read Find Options
Replace All $find, $replace, $options, '-am'

Code: Select all

### Replace All in Notes ###
$find = Read Find Expression
$replace = Read Replace Expression
$options = Read Find Options
Replace All $find, $replace, $options, '-an'
User avatar
Hamid
Posts: 777
Joined: 2007-01-17 03:25:42

Re: Limiting Search to Body or Notes . . .

Post by Hamid »

goldste4 wrote:I've attached a page or so from the file that is giving me problems, for anyone who is curious (there are tabs in every footnote, and one tab in the body).[...]
Josh
Since the font size of the notes is 10 pts, you can do Attribute Sensitive search for 10 pts. Any replace will not affect the body text which is 12 pts.
Place the cursor at the start of the document and in the Find window choose the option 'Here to End'; otherwise the replace will also affect the header which is 10 pts.
User avatar
martin
Official Nisus Person
Posts: 5230
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Limiting Search to Body or Notes . . .

Post by martin »

Kino is exactly right, if the selection contains footnote/endnote references, the text of those notes will also be searched. You can control that behavior when using the macro language, but not in the Find & Replace panel itself. Adding that option to the panel is filed as an enhancement request.
goldste4
Posts: 98
Joined: 2010-02-22 15:06:48

Re: Limiting Search to Body or Notes . . .

Post by goldste4 »

Thanks Kino, Hamid, and Martin for all your help. I'll make good use those very handy macros, Kino. Much appreciated. Josh
Post Reply