Jump to content

Recommended Posts

There's a thread here about searching and replacing text that includes the following suggestion:

To find and delete text, select "regular expression"
In the text within the Find field, don't use parens.
Use "\1" alone in the Replace field.

This does work. For example I had ;h2\s+ for the "find" expression and "\1" alone for the replacement. All occurrences of ";h2" followed by 1+ space(s) were deleted. Yes, it works, but it seems like a bit of a hack. So...

•  Is there another approach to execute a global find-and-delete operation throughout a long collection of text in linked text frames? In nearly all of the word processors and text editors I've used, an empty replacement field means: "delete." Is there some reason it shouldn't also mean "delete" in Publisher? (Not meant as a rhetorical question.)

•  I found that with the cursor at the start of the text, sometimes pressing the Find button caused the cursor to advance to the first "found location," and sometimes the cursor remained at the start of the text. This appears intermittent and I can't predict when it will happen. I'm assuming it is a bug. If it isn't a bug, what would the reason be for the "variable" behavior?

 


Affinity Publisher and Photo 1.8.3 (Windows). Lenovo laptop with decidedly sub-optimal monitor. At least it works.
“The wonderful thing about standards is that you can have as many of ’em as you want.”
– Anonymous cynic

Share this post


Link to post
Share on other sites

An empty Replace field works just fine for me to delete text, Mike. There's no need to use an uncaptured \1 to do the deletion.


-- 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.815 Beta   / Affinity Designer 1.8.5.703 and 1.9.0.815 Beta  / Affinity Publisher 1.8.5.703 and 1.9.0.798 Beta.

Share this post


Link to post
Share on other sites

@walt.farrell Alas, the empty replace field isn't working for me. When a 'find' occurs, the replacement field is empty, and I click 'Replace,' the program ignores what's just been found and moves on to the next 'find'.


Affinity Publisher and Photo 1.8.3 (Windows). Lenovo laptop with decidedly sub-optimal monitor. At least it works.
“The wonderful thing about standards is that you can have as many of ’em as you want.”
– Anonymous cynic

Share this post


Link to post
Share on other sites

More playing-around with it . . .

An example of when it didn't work:

I typed ;h2 (followed by a space) at the start of certain text I'd planned to make into subheadings. Then:

Find: ";h2" (followed by a space) (this is a normal search, not a regex search)
Replace: (nothing at all) — and format as Heading 2
Click: Replace All

Result: the paragraphs in question are styled Heading 2 as expected. The string ";h2" is not deleted.
Same result if Regular Expression is set and the find and replacement strings are the same as above.

When it did work:

Find: ";h2" (plus one space) (regex not set)
Replace: (nothing at all) — and no change to text formatting.

It also worked in this case:

Find: ";h2" (then 1 space) — set "Regular Expression"
Replace: "\1" — and format as Heading 2
Click: Replace All

Result: the string ";h2" followed by a space was removed AND the paragraphs in question were formatted as Heading 2.

 


Affinity Publisher and Photo 1.8.3 (Windows). Lenovo laptop with decidedly sub-optimal monitor. At least it works.
“The wonderful thing about standards is that you can have as many of ’em as you want.”
– Anonymous cynic

Share this post


Link to post
Share on other sites

Thanks, I vaguely remember that. If you're setting formatting you do need a replace string. 

 


-- 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.815 Beta   / Affinity Designer 1.8.5.703 and 1.9.0.815 Beta  / Affinity Publisher 1.8.5.703 and 1.9.0.798 Beta.

Share this post


Link to post
Share on other sites
57 minutes ago, walt.farrell said:

Thanks, I vaguely remember that. If you're setting formatting you do need a replace string. 

What I observed might be intentional. When you're specifying a formatting change, the program can't know if you want it only to format the "found" text and move on to the next occurrence, or if you want to format it and delete the "found" string. So — safer to leave it alone. I'm glad the \1 workaround exists when Regular Expression is selected.


Affinity Publisher and Photo 1.8.3 (Windows). Lenovo laptop with decidedly sub-optimal monitor. At least it works.
“The wonderful thing about standards is that you can have as many of ’em as you want.”
– Anonymous cynic

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.