'Special' search-and-replace

I’d really, really love a search-and-replace for ‘special characters’ - things like carriage returns.

At the moment, for instance, I’m looking at a project that has double paragraph returns throughout. It’s separated into separate chapters with scenes in them. Each scene of 1,000 words or so has double paragraph returns between each paragraph; I’d like them to be single returns followed by a normal tab indent.

To do this, I have to cut-and-paste every one of the 56 chapters (plus prologue and epilogue) in succession into Word, use Word’s ‘special character’ search-and-replace to change the formatting, and then copy them back into Scrivener.

How easy and pleasant life would be if there were a search-and-replace for these invisible characters, and if I could do it project-wide!

You can already do this - you don’t need to copy into Word to do this at all. Suppose you want to replace double returns with single returns, then you would do the following:

  1. In the “Find” field, hold down the Option key and hit return twice.

  2. In the “Replace” field, hold down the Option key and hit return once.

Now hit “Replace All” or whatever (depending on whether you are in Project Replace or using the regular Find panel).

This can be done in all Mac programs with a Find & Replace field.

I do agree that having the invisible characters displayed in the text fields would be easier, and that is on the list, but it is a much bigger technical challenge than you would think, because of the way text fields work.

Hope that helps.

All the best,
Keith

It doesn’t, Keith. Tried this on Edit>Project Replace and got “Not found”. Should something appear in the search field when i do it?
(I also tried it in a search-and-replace in a document; while this alleged “6 found”, I didn’t see any replacements.)
The project I’m using is the Compile Test project I sent you, with the Joyce stories.
Edit: when I actually insert some double returns in the Scrivener document and use the option key as you say, it does work. Maybe these returns in the copied-in text are some strange kind of return?

What you could do is use Format > Options > Show Invisibles to display your invisible characters. You may find that they aren’t paragraph returns but Ctrl-Return instead. You may also find that the second of them is preceded by a space. In any case, regardless of what the characters turn out to be, find an example of what you want to replace, select those exact characters, copy them, then paste them into the Find field and proceed as before.

Thank you, Siren; in fact, I’d tried this but it hadn’t worked.

Similarly, I’m now formatting a book of dialogues, which are introduced by the characters’ names:

Martin: I would wish that I could do such a thing.

I’d like to have the characters’ names (eg ‘Martin’) emboldened, but can’t see any way to do this. 'Twould be dead handy to have that.

Scrivener is intended primarily as a tool for creating long-text first drafts; it is not really designed as a post-processing formatting or layout tool, despite the fact that it offers a lot of functionality in these areas, and we always suggest that some tasks are better finished off in an appropriate dedicated application. If you are trying to tweak the final layout and formatting of existing texts (as would appear to be the case here), I would suggest that it might be easier to make your changes in a suitable word processor after output from Scrivener. If you don’t like using Word (and who could blame you? :smiley: ) you might like Nisus Writer Pro, which can certainly accommodate the sort of global formatting edit that you are trying to achieve with your “Martin:” example.

All the best,
Astrid

Yes, I can take the 21 separate chapters out and format them one by one in Word or another word processor to embolden the names. But it would be nice to be able to do this simple task of emboldening these particular words in Scrivener, project-wide!

Not a biggie. But this is my request for the Wish List list.

One option for post Scrivener formatting/printing is to compile the total Scrivener document as text and them import text into text frames in scribus.

scribus.net/canvas/Scribus

Create a series of text frames across a number of Scribus pages with textframes all linked for auto overflow of text.

Right click on textframe and “Get Text” (your Scrivener compiled document).

Then you can search and replace formatted words (bold etc.) throughout your document.

Attached is example of search and replace window.

[Later edit]

Further note …

documentation.scribus.net/index. … nd_Replace

So this feature does apply to linked text frames but not to unlinked text frames.

Thank you, this is good. Then reimport them and split the 21 separate scenes and put them into 21 separate named folders again?

On reflection that idea only searches and replaces the final document in Scribus.
You want to see the effect of search and replace in your Scrivener project documents.
So some form of batch search and replace of text applied to your project.scriv/Files folder (*.rtf files) may meet your needs.

You can most certainly search for carriage returns, and any other white space, in Scrivener - I do it myself regularly. There is no need to use another app for this.

There are several “wishes” included this thread …
I was giving some thought to this wish …

Depending how the document is formatted, you could pull this off in script mode by creating a custom script setting so that text before the colon delineator is emboldened. Then you’d switch each document you want to change into scriptwriting mode, set all the text as the new element you’d created for the script, run the conversion, and finally switch them all back out of scriptwriting mode. (The last step isn’t necessary but may be handy for resetting the paragraph formatting to your defaults. If you’re still writing, stay in script mode so you can have your character names automatically emboldened when you write to avoid trying to do this all after the fact.)

Yes, I’ve made one request - that Scrivener should add ‘special’ search-and-replace - and given two examples.

Meanwhile, to to embolden the names in 21 documents in one project, I should

  1. One by one, change the 21 chapters into script mode (how?) and create a custom script setting (how???) to embolden the name and colon;

  2. Change them all (one by one?) back out of script mode (how?)?

I think, honestly, I’d be faster to whip them all over into Word (hopefully keeping their font and size settings) and change them there, all 21 of them, then copy them all back (hopefully keeping their font and size settings) into Scrivener.

But it would be nice to do this project-wide in Scrivener, and to be able to do the same with other ‘special’ formatting like indents, italicising titles, ship names and so on.

Sure, the script mode was more a hypothetical, as a way you can currently do this in Scrivener, and as I said it’s somewhat special case here since you happen to want to embolden the initial text of each paragraph up to a colon; this wouldn’t work with just any find and replace for formatting. Anyhow, for the time being I think just doing a copy and paste in and out of Word would be fastest for you to get what you want, unless you have comments/annotations or footnotes. Select all the documents in the binder first and use Documents > Snapshots > Take Titled Snapshots of Selected Documents to preserve a copy of their current state before round-tripping through Word, just as a precaution. Then just go through each document, select all in the editor, dump it in Word, run the formatting replacement, copy it all, and paste it back into the Scrivener document, overwriting the current text.

Thanks, Jennifer - I think you’re right; using Word for this is kludgy but the simplest thing at the moment.

But I’d love future versions of Scrivener to have ‘special’ search-and-replace for things like emboldening, italicising, carriage returns, indents, and so on.

Copying-and-pasting double carriage returns in Scrivener and asking it to replace them with single carriage returns didn’t work for me, Keith.

For a start, copying-and-pasting these ‘special characters’ showed nothing in the Search field,

I tried running it on a piece I’d written in Scrivener, and it did work. But in this piece -


As I walked along in the sun I remembered old Cotter’s words and tried to remember what had happened afterwards in the dream. I remembered that I had noticed long velvet curtains and a swinging lamp of antique fashion. I felt that I had been very far away, in some land where the customs were strange–in Persia, I thought… But I could not remember the end of the dream.

In the evening my aunt took me with her to visit the house of mourning. It was after sunset; but the window-panes of the houses that looked to the west reflected the tawny gold of a great bank of clouds. Nannie received us in the hall; and, as it would have been unseemly to have shouted at her, my aunt shook hands with her for all. The old woman pointed upwards interrogatively and, on my aunt’s nodding, proceeded to toil up the narrow staircase before us, her bowed head being scarcely above the level of the banister-rail. At the first landing she stopped and beckoned us forward encouragingly towards the open door of the dead-room. My aunt went in and the old woman, seeing that I hesitated to enter, began to beckon to me again repeatedly with her hand.

I went in on tiptoe.

copied from a website, it didn’t. Then I copied the piece and pasted it into a Word document and used Word’s ‘special’ search-and-replace, which worked perfectly. I have no idea why this should be.

Hi, I’m sorry, but this must be something you are doing wrong, not something wrong with Scrivener - I just did this again only this morning. I had some text I wanted to represent as an email reply, so I added some newlines, then searched for return characters and replaced them with returns followed by a “>” character. It worked beautifully. The only difference in Word is that it shows these special characters as invisibles in the search field - which, as I say, is nice, and on the list for the future, but not necessary to get it to work.

Just to remind you - to enter a return character into Scrivener’s “Find” field, hold down the Option key while hitting return.

It definitely works. :slight_smile:

As for finding italics and suchlike - you can do that using Edit > Find > Find by Formatting, although you cannot replace the italics and such that you find with different formatting, true. It’s never come up before.

I’ve already said that it won’t - you won’t see them in the search field any more than you would in the main text.

I just tried that in Scrivener, and it worked beautifully. My guess is that you already have some characters in the “Find” field that you haven’t cleared. Try putting the cursor in the Find field, then hit Cmd-A (“Select All”) and backspace to ensure it is empty. Then hit Option-return to enter a return character in the Find field (you won’t see anything, as I say, this is the one improvement it does need but which is more difficult from a technical standpoint than you would think). Then click “Find”. It will work. :slight_smile:

All the best,
Keith

Keith - Returning to this problem; I still can’t get it to work.

At the moment I’m trying to clean up an internet version of Victor Hugo’s book ‘Ninety-Three’. I’d like to replace the double carriage-returns with single ones, to replace carriage-return-followed-by-quotes-then-space-then-word with the same only the quote without a space after it, and so on.

I can’t get Scrivener to “show invisible” characters, nor can I find this in the Help menu, nor can I find any menu for searching with special characters.

I can put in two carriage-returns in the Find field of the search-and-replace box by hitting the Return key twice, but if I then try to put in a single carriage-return (by hitting the Return key) the cursor simply jumps out and into the text. And nothing happens.

Is there an easier way of doing these search-and-replace actions for special characters?

Oh, wait; theoretically, I can insert those carriage-returns by pressing alt and then the Return key. But the document refuses to believe that these carriage-returns exist; it comes back with “Not found”. Can they have been made with something other than the Return? I’ve tried looking for space-return, but no dice. Not being able to see what the invisibles look like on the page leaves me without a clue as to what I should be replacing.

LATER: No worries; I put the document into Word and did the whole thing there, as before.