Jump to content
You must now use your email address to sign in [click for more info] ×

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

Link to comment
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
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
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

Link to comment
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

Link to comment
Share on other sites

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

 

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
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

Link to comment
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

Terms of Use | 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.