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

APub2 [Bug?] Search and Replace with Regex and Styles seems broken


Recommended Posts

broken_regex_replace.afpub

Simple repro cases is attached.

If I search for a style (=Strong) with regex like in this image

image.png.b3713cb20705568068c2ce73cbb39b1a.png

there appear two locations where APub has found them. They are correct. However, double clicking on the location does not cause the main view to focus at this location ("jump to" seems broken). Replacing the match does also not work. When I hit `Replace all` nothing happens.

Is there a workaround for this? I have 400 pages of styles for which I need markup ...

 

Despite some short comings APub2 is really an improvement. Thank you 👍

 

Edit: I thought I found a workaround [only for paragraph styles]. Using the regex (.+) -> plus, not asterisk for matches. This seems to work on paragraphs well but not on character styles but this still mess my entire document up because all character styles are not updated. I will post a repro bellow.

Affinity User on Windows 11

Link to comment
Share on other sites

I am a bit surprised at your replacement string having $ in it, rather than $1 or \1. I would have expected that to replace with a literal $ rather than the captured string.

Other than that, I'm not sure what's happening, but I'll see if I can reproduce it. 

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

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 17.7, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.7

Link to comment
Share on other sites

24 minutes ago, lacerto said:

I think you need to specify search clause as:

image.png.f3b2039670be65b8a4225df7c93daa0b.png

The behavior seems to be same in version 1, so .* seems to show the instance but does not seem to work when replacing (or focusing).

This will mess up all my character styles that are "Strong" but do not match \w.

What do you get during replacement when you keep your regex, set Replacement Character Style to Strong as well and then place a whitespace in the word `ante` making it `an te`?

Hitting replacing all really causes havok in the file.

Before:

image.png.167d455d9eca148debdd9354bd7a14d2.png

After:

image.png.2c7d1bc6cf9e678d0c0737a05db2f5aa.png

This looks like a disaster to be honest. With no proper way to diff my apub files beside exporting to pdf and version them this appears to me to be a "very" dangerous regex quirk.

It would be somewhat ok to get `an te` having multiple <b>s resulting in `<b>an</b> <b>te</b>` but carrying the second match of the first Character style to the next match and replacing it is a little bit too weird.

 

Relevant

image.png.6394e727169b4d533e27840005cf45d2.png

(Original)

Affinity User on Windows 11

Link to comment
Share on other sites

It is true, though, that using (\w*) instead of (.*) allows replacement to work. So something odd is going on with the reg-ex search or replace processing.

 

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

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 17.7, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.7

Link to comment
Share on other sites

I found a work around: Using (.+) instead of (.*) actually works as expected, but only for paragraphs. For Character styles it is still broken

Yay. I wish the 4 hours of manual labour wouldn't be necessary but I am pretty sure I just saved many more hours for my next step.

All is moot. I found another bug. Will create a repro

Affinity User on Windows 11

Link to comment
Share on other sites

Ok, here is the repro. File attached.

next_regex_bug.afpub

This is my starting position. I marked the strong elements in the text

image.thumb.png.03b6815ef9a8661c9b36ca49a83859d5.png

Now I hit replace all and the glyph range of strong changes.

image.png.ffeda07d65d1de8dfbc800fec64d2be8.png

To be honest, this is the point I really regret choosing Publisher over InDesign (sadly not the first time) as I am now again vendor-locked and cannot export anything out of APub 2 that allows me to further process the data in other tools without manually redoing hours of work. (I know bugs are happening and what doesn't work for one customer, works for another and Serif is always committed to the cause, which I followed a long way but at the end results matter)

[This last bit is written out of frustration, and while I do not expect that "everything" gets magically fixed all I can do is give a sincere feedback and hope for adjustments further down the road. I know you are working hard on the Affinity Suite.]

 

 

Affinity User on Windows 11

Link to comment
Share on other sites

  • 2 months later...

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.