Jump to content
Pelted

Publisher: Limit scope of Find and Replace?

Recommended Posts

I've got a rather large document (300+ pages) that is divided into sections. The text gets placed then a few "find & replace" steps are done to clean things up before flowing. Works great, but no I have some small "find & replace" steps that need to only happen to particular sections and there doesn't seem to be any way of scoping this to section or even to selected text areas. This is supper problematic as the changes I need to make to smaller sections (15-60 pages) would wreck major layout issues if they are done to the entire document.

Share this post


Link to post
Share on other sites

Find/Replace as currently implemented apply to the entire document.

There are some ways, using the Regular Expression option of Find/Replace, to reduce that scope, but for now the only ones that I have found involve making some small changes to the document.

For example, if you wanted a particular change to occur only to the text contained in a certain set of linked text frames that spans pages 5 through 10 then you could:

  1. Pick a text string that does not occur in your document, perhaps something like %%%
  2. Add that string at the beginning of the text frame on page 5, and at the end of the text frame on page 10.
  3. You could then do a Find/Replace, with the Regular Expression option turned on, where your regular expression will look for %%% at both the start and end of the expression.In the middle you would build the rest of the regular expression to find the text that needs to change. And then you would use a corresponding regular expression Replace string to actually make the changes.
  4. After the Find/Replace operation, you would remove the marker from the start and end of the text frames.

Note that if your Publisher document is organized as separate Stories, where a Story is a complete set of linked text frames, and you want to restrict the Find/Replace operation to one particular Story, you can just add the marker at the start of that Story, and for the end of the Regular Expression you can use \z in the expression, without needing to insert the marker into the text frame. But you still need the marker at the beginning of the Story.

Note, too, that step 3 can be tricky, and will of (course) require knowledge of regular expressions. For example, to change the name Tom to Fred within that set of text frames, something like this might be used as the Find expression: (%%%.*?)(\bTom\b)(.*%%%)

The Replace expression would then be \1Fred\3 (or $1Fred$3).


-- Walt

Windows 10 Home, version 2004 (19041.388),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.8.5.703 and 1.9.0.734 Beta   / Affinity Designer 1.8.5.703 and 1.9.0.734 Beta  / Affinity Publisher 1.8.5.703 and 1.9.0.742 Beta.

Share this post


Link to post
Share on other sites

Thank you Walt for the detailed response. I'm actually much more familiar with regex than I am publisher documents so by the time I got to your reply I had already built an external text processing tool and rebuilt the pages based on that output. I missed the regex option in Publisher as it didn't occur to me to just set unique text markers in the frames. Duh... I over engineered a solution when there was an easy one sitting right there.

Hopefully in the future they as scope to the Find & Replace features, but this is a solid work around. Or better yet, a scripting interface for automation throughout the suite.

 

Thanks

Edited by Pelted

Share this post


Link to post
Share on other sites

I'm also finding the inability to scope Find and Replace to be problematic at the moment.

I'm already using complex regular expressions so could expand those but it's not ideal.

I also can't do the work outside of Publisher because I am applying styles on the replacement.

Then again, the only reason I have to be doing these Find and Replace actions is because it's the only way to get styled text into Publisher. (I copy Markdown so I have the characters to target for replacing with styles.)

 

Share this post


Link to post
Share on other sites
On 2/4/2020 at 8:56 PM, Pelted said:

I've got a rather large document (300+ pages) that is divided into sections. The text gets placed then a few "find & replace" steps are done to clean things up before flowing. Works great, but no I have some small "find & replace" steps that need to only happen to particular sections and there doesn't seem to be any way of scoping this to section or even to selected text areas. This is supper problematic as the changes I need to make to smaller sections (15-60 pages) would wreck major layout issues if they are done to the entire document.

I agree: it should have an easy way to limit the scope when choosing "Replace All", i.e only the selected text or the selected story (linked text frames). Regular Expressions are OK for very advanced users but not for normal people, and Affinity Publisher is aimed for regular people, right?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

Please note the Annual Company Closure section in the Terms of Use. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.