I want to be able to search for specific characters (non-printing characters, punctuation marks, etc), but my current method seems a bit hit and miss. Sometimes, I want to find all instances where (for instance) a double quote is followed by a comma (",), but when I search, I don’t get that. Is there a way of doing this?
Secondly, in the search by formatting option, is there a way to store the search results as a collection? I want to highlight certain text with a specific colour so that I can check/revise it later. Also, when I’m doing this (searching for things highlighted with blue, for instance), it doesn’t always work, for some reason.
To help others help you… your profile shows “Windows”, but this is the Mac forum. Which OS are you using, and what version of Scrivener (if Windows, are you using the beta, or the latest 1.x version)?
From what I can tell, the issue with searching from quotes probably has to do with “smart” vs. “dumb” quotes not matching. I think Keith enabled searching for all double-quotes by entering straight quotes in the search field, but that’s only for the latest version of Scrivener for Mac. Not sure what the state of the search function is on the Windows beta.
So, there are several searches available in Scrivener 3, so I’m going to use the “Project Search” function as an example.
I think maybe you’re running into a limitation on that code that Keith put to match all kinds of quotes. Does it find both left and right smart quotes if you search for just a quote? If so, maybe this alternative will work:
Bring up the project search Edit->Find->Project Search (turns the binder into a search results list). Click on the loupe icon, and make sure these are turned on: Text, Regex and make sure that the other options make sense for where you’re searching.
Regex is a kind of programming language for searching, only is super complex sometimes. So just enter this in the search field:
(“|”),
That’s a left and right quote, inside parenthesis, each separated by the vertical bar, all of which is followed by a comma. It equates to: Match either a left double-quote, OR a right double-quote, followed by a comma. The resulting list of documents can be selected, and CMD-g will find each instance of the ", found within the document.
If that works, then you can save that search as an alternative to just using a “dumb” quote. You should probably post to the Bug Hunt forum if an isolated quote works, but a quote followed by a comma doesn’t. I assume that’s not the intended behavior.
Click the loupe icon again. At the bottom, there should be a “save search as collection” item you can click on. To get back to it after using Scrivener in the normal mode, you need to reveal your “collections”, which the saved search will be listed among. When you return to it, the search runs again, so that it can pick up documents that now have matching text, and documents that no longer have matching text will drop off the list.
FYI, this search doesn’t work on text formatting. So that may need to go into a feature request.
Ah, sorry. I thought you meant the text that is highlighted (selected) in the text when you perform a search, not the “highlight” formatting.
The one thing not covered in this discussion is non-printing characters. If you can either type them, or copy and paste them, then they’re typically usable as search terms. REGEX also has some of them represented by escaped characters: \n for newline characters, \t for tab, etc… Here’s a link I found with a very detailed list of escaped characters and what they actually match: regular-expressions.info/refcharacters.html
Thank you again. I’ve no doubt that list of non-printing characters will be super handy at some point!
Regarding collecting highlighted text (e.g. blue or orange) into a search collection, I guess that’s not currently a feature, and there is no other way to group bits of text in some handy way? The sort of use I’m thinking of is (e.g.) quotes that will need to be cleared for permissions.
Not that I’m aware of. But you might consider switching to some other way of marking text. Inspector comments might be a viable solution. If you have them, and you enter Scrivenings mode for your entire manuscript, they will stack up in the inspector pane. Clicking on one will scroll you to that section of the text. It’s not quite as easy to change the color of those highlights, but as you’re adding these comments, you could add text to the comment that gives each passage context, such as if you’ve asked for permission yet, or if you’ve gotten it (unless you just delete the comment at that point… but then how do you know you got permission when you do a future editing pass?). It’s not quite a search, as you’d have to scroll through the list of all your comments, and you’d have to remember to enter Scrivenings mode and switch to the comments section of the inspector, but it might be more useful.
Alternately, you could add inline comments to the same effect, with the added bonus that the text therein is searchable. Add a short prefix that’s hard to misspell, and won’t occur anywhere else in your text (":NP:" for “Needs Permission” maybe?) plus any other commentary. You could then save a search based on all instances of “:NP:”. When you get permission, you could then change that inline annotation to start with “:GP:” for “Got Permission”, plus maybe the date, or where you keep your records of such granting of permissions. Compile settings allow for the removal of inline annotations.