Search and replace

Sorry to ask what is probably a really dumb question.

I’m trying to search and replace a character’s name. It occurs in the texts, notes, synopses and titles throughout my Draft folder. There may be instances of the name in my Research and other top level folders, so I want to exclude those from the replace. How do I do this?

Thanks. I’ve searched and can’t find an answer in the manual or in the forum.

Yes, it’s possible!

  1. Click on the “Draft” folder that contains all your manuscript documents
  2. Press +1 to enter Scrivenings mode (if you aren’t in it already) so you can see your entire Draft as a single document in the Editor
  3. Press +F to bring up the Find dialogue. Any search and replace parameters you put in now will apply across the whole selected Scrivenings session - ie your whole Draft folder - but will ignore anything else (Research, etc).

Thanks Pigfender. So once I’m in the Ctrl F Find dialogue, there are two options for ‘Replace All Scope’.

  1. Entire File. Does this mean the whole Scrivener project (regardless of what is selected in the Binder)? Or is it just the items listed in the Binder? Do they need to be highlighted?

  2. Selected Text. Does this mean the items listed in the Binder? Or is this an option to restrict the scope by highlighting some items in the Binder? Or to restrict it by highlighting some text in the editor?

And then, for both cases, will this action replace words in the synopses, document notes and titles as well as in the text in the editor window?
In the other search dialogue (called ‘Project Replace’), there are options to restrict the scope by notes/title/synopsis/etc, but no way that I can see to exclude the Research and other folders.

I don’t want to mess up my project by getting this wrong!

The standard Find/Replace works on text visible in the editor; “Entire File” refers to the documents loaded in the editor (which may be one or more, if you’re in a Scrivenings session) and “Selected Text” refers to text selected in the editor in the currently focused document. (That is, if you have a Scrivenings session loaded and have text selected in multiple of those documents, only the one currently in focus–whose title is displayed in the inspector index card–will have the replacement performed in its selected text.)

Find/Replace only works on the main document text; it does not affect notes, synopses, etc.

Project Replace will replace text throughout the entire project, regardless of where it is in the binder.

I highly recommend using File > Back Up > Back Up To… to create a complete backup of the project before you do a large-scale replace. Depending what exactly you’re trying to avoid with the replace, you might be able to get around this by taking snapshots of your Research documents, etc. that contain the name, then running a project replace (which will replace those instances as well as instances in the Draft) and then rolling back to the snapshot version to restore your research documents to the pre-replaced version. This will only preserve the text in the document, though, as snapshots don’t capture document notes or synopsis information.

Before any of the replacements, you may want to run a project search for the term to see where all it is used outside of the Draft folder–it may be that you only have one or two documents where this is an issue, and a project replace and then just adjusting those to use the earlier text is probably easiest.

So, just to make this 100% clear, the answer to my original post is that this kind of search/replace isn’t possible?

Thanks, MM, for the explanation and work-rounds. But they do sound kind of kludgy and risky! Is there a design reason that search/replace can’t do this, or is it just not quite there yet?

Re snapshots: I’d made extensive use of synopsis and document notes, before realising that snapshots do not preserve this data - so I’m kind of stuck in a situation where I now have to avoid them for large parts of my project. Which is a shame! Are there plans to include change this situation in the future?

Sorry to sound negative. So many things about Scrivener are great :smiley: , and it’s disappointing to discover these limitations.

Just to let you know that there is another option available now that version 1.2.5 has been released.

You can use the ‘Replacements’ pane in the Compile dialogue to make replacements in any files you compile whilst leaving the Draft in your Scrivener file (and therefore also all your research files) unchanged.

I’m up against this old chestnut again: how to replace every instance of a word (a character name) in everything but the Research folder (inc. notes, synopsis etc.)

Since there is no way of doing this cleanly using the current search options, it seems to me that the best way is:

1 - do a copy of the entire project.
2 - delete the Research folder in copy A
3 - do a Project search and replace in copy A
4 - copy the Research folder back over from copy B

There are about a thousand documents in the project. Is this likely to work ok or is there anything I’m missing?

Last time I faced this it turned out the name I was replacing was fairly unusual and I decided to live with any unwanted changes in the Research folder. But now I have to replace quite a common name, and I need to isolate the Research folder from the replace.

Please can I have some advice about this from the Scrivener pros. :slight_smile:

As above, I want to change the name of a character throughout the Project (Project A), in everything but the Research folder (inc. notes, synopsis etc.).

It seems to me there are several options. There is the method above. Or:

  1. Create a new Project (B).
  2. Copy the contents of the research folder from A to B.
  3. Delete research folder in A.
  4. Do a Project replace in A.
  5. Copy the Research folder back from B to A.

Is there anything to choose here? Am I going to lose anything by doing this (eg internal links, formatting, snapshots?). Should I do it another way? What do you advise?

Another question: in Project Replace, what exactly does ‘Ignore Case’ do? Whose case is ignored - the search term’s, the replace term’s or target text’s?

If I want to replace Joe with Jim and JOE with JIM, does this mean two separate searches? With which options enabled?

Finally: if ‘Whole Words Only’ is checked, will a search for “Joe” find “Joe’s”?

Any ideas about this, please?

Dragging items into a project imports them anew, meaning they’re going to get new ID numbers internally. Scrivener links are based on the ID numbers, so yes, in the scenario you describe of moving items out of the project and then dragging them back in, any internal references including those documents would break. Formatting, snapshots and other meta-data travel with the item from one project to another, so that would all remain intact. You might lose the colour of a label if you dragged it into a project already containing a label of the same name but different colour (the added document would pick up the destination project’s colour), though obviously in this case that’s not an issue. Similarly, although custom meta-data will copy, it won’t appear unless the destination project has identically named fields.

If “Ignore case” is not selected, the capitalisation of the search term (i.e. in the “replace” field) must exactly match. The search term will always be replaced using the capitalisation of the “with” term as entered, regardless of “Ignore case”. Thus, if you have “joe” and “JOE” and want to replace with “jim” and “JIM” matching the original capitalisation, you’ll need to run two separate searches, with “Ignore case” deselected. Then you can replace “joe” with “jim” in one round and “JOE” with “JIM” in the second.

“Whole word” here means just alphanumeric characters. If you have “Joe’s” and replace all instances of “Joe” with “Jim” with “Whole words only” selected, you will still get “Jim’s”. You will not get “Joey” becoming “Jimy”.

Thanks very much for the explanations. Unless you’ve got any other ideas, it seems like there just isn’t a way to do this.

Before I make a wishlist request, can you let me know if there are already improvements to Search and Replace in the pipeline?

The ability to run the project replace only on selected documents is already in the plan. I’m sorry it’s not coming soon enough to help you out with this project!