Compile Replacement fail

I’m already using the 2nd & 3rd Replacements in the image, and it works great. I can easily change image sizes and adjust external paths for Mac & Windows.

Now I want to automate it a step further with the 1st Replacement … but it fails. {Divided Minds} compiles as-is.

I tried reversing the order of those Replacements in the pane, and that didn’t work either.

(I have no idea if you intend the ordering of Replacements to matter or not.)

I’m not seeing anything in your first row that would replace {Divided Minds} with anything. You’d have to have {Image Name} in the text of your document.

After some thought, I think I know what you’re after.

If you intend {any text in curly braces} to match up to a binder item name, then you need to use a more sophisticated searching feature: Regular Expressions, which you appear to be trying in other searches.

With the Regex checkbox checked, put this into the Replace column:
({[A-Za-z0-9 ].*})

That will match any number of letters (upper and lower case), numbers or spaces (including none at all) that are enclosed in a pair of { }s. The parentheses tell the search function to store what it finds for use in the replacement output.

So it will match
{My Image}
{ANOTHER IMAGE}
{image 45 of 90}
and even {}

Note that it will also match {1} and {2}, but you could easily just search for 1st and 2nd instead if you want them replaced with words.

In the With column, where you want the text found inside the curly-braces to appear, put
$1
… and that will substitute the text inside the curly braces (but not the braces themselves).

To sum up, in the Replace text field , put this:
({[A-Za-z0-9 ].*})
and in the With text field, put this:
<$img:bookImages$1.png;w=imageWidth>

I’m not sure if the bookImages and imageWidth rows will operate on the replaced text; I don’t think replacements in Scrivener work recursively. Test it out, but I think it has to be in the text of your document before the compile process starts in order for that text to be found and replaced by the Replacements rule. You may have to alter your Replace and With field in one row to do all of the work in one go, instead of splitting it across multiple replacements rows.

I don’t need RegEx, I think, but DUH, what a dummy I was.

I didn’t use proper notation at all!

Correct is this:

Replace: {$@} With: <$img:bookImages$@.png;w=imageWidth>

I found that the order of Replacement rules DOES matter, too. The $@ rule has to come before the other two.