Page 1 of 1
Limiting Search to Body or Notes . . .
Posted: 2010-07-14 18:30:54
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
Re: Limiting Search to Body or Notes . . .
Posted: 2010-07-15 04:00:38
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.
Re: Limiting Search to Body or Notes . . .
Posted: 2010-07-15 04:58:25
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
Re: Limiting Search to Body or Notes . . .
Posted: 2010-07-15 05:28:38
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'
Re: Limiting Search to Body or Notes . . .
Posted: 2010-07-15 08:29:12
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.
Re: Limiting Search to Body or Notes . . .
Posted: 2010-07-15 11:07:12
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.
Re: Limiting Search to Body or Notes . . .
Posted: 2010-07-15 11:23:14
by goldste4
Thanks Kino, Hamid, and Martin for all your help. I'll make good use those very handy macros, Kino. Much appreciated. Josh