RegEx search oddity

Here’s an example where a RegEx search works in Project Search but not in Find. The latter should NOT work, I think, so why does the former?

Hmm, it looks like RegEx mode is not actually triggering when using either [ or {, but will trigger once you add other forms of special punctionation. For example, type this into Project Search:

[Fif

All right, we get the document with “[Fifty yards, sir.]” in it. Now type:

[Fif.

No results. It’s now being interpreted as a regular expression string, and failing at the moment since the syntax is invalid.

What has me confused is why the Find tool is stricter than the Project Search tool. They should both be using the same Cocoa method here. Well one possibility is that Scrivener does do some additional string parsing itself. It has some simple syntax, like using “quoted phrases” to introduce an Exact Phrase search element in conjunction with a word list supplied to Any or All Words. Likewise it also some date search syntax. So maybe something in there is handling the string before it gets to regex, until what has been typed in fails to match the precondition.

Yes. Why don’t Find and Project Search use the same RegEx rules?

I should use valid RegEx syntax in both, I suppose.

I just tried to send a screenshot of doing that (success!), and your webpage said “File too large”. (It’s 1.5 MB)

It’s not easy getting tiny screenshots on a 5120 x 2880 monitor. Trying again:

They definitely do use the same RegEx rules (both use the Cocoa engine), but in Project Search there is a layer of parsing that Scrivener is doing that it won’t be doing in Find, and it looks to me as though it is not dropping to full RegEx until you get past the parsing layer. That’s just an educated though, I could be wrong.

As for screenshots, I tend to downsample mine to what will look good at 72 DPI, since not all browsers/monitors will be able to do anything with that larger Retina image anyway. For simple stuff I also then save as PNG-8bit indexed palette, using anywhere from 16 to 128 colours. Many grey-only screenshots don’t need much more than 16 so long as there aren’t any shadows.

You should install ImageOptim.app — it can compress screenshots by 60-80% (if you use lossy compression option, quality is still good). I’ve made an automator workflow that takes a Finder selected image, copies it, resizes it 50% (effectively taking a retina res to non-retina), then sends it to imageoptim automatically.

imageoptim.com/mac

EDIT: See below

To install the workflow, just copy it to ~/Library/Services/ and then select an image, and use the services menu entry “50% resize”

Sounds great, but I get this error when I try it on a screenshot:

Hm, works fine here. I’ve remade it in Automator, see if this now works:

  • Delete the previous workflow from ~/Library/Services/
  • Extract new workflow from the zip onto the desktop
  • double click it, and macOS should ask to install it, say yes

Screen Shot 2018-09-25 at 05.40.11_SML.png
50% Resize.zip (124 KB)

Thanks!

That works, but it takes a minute or two. I’m not used to anything taking that long on the MBP.