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

Clipped search pattern when reusing recent regex


Recommended Posts

Before I give the recipe, I need explain that in the regex below, I am using \n to stand in for a line break, but unfortunately, \n does not match line breaks in Affinity, but carriage returns. The only way I know to search for a line break in Publisher is with the dropdown, and consequently I can't give you a regex pattern that you can copy from the forum. (That \n is treated as a duplicate of \r is a frequent annoyance to me, and it breaks compatibility with other regex, but that is a tangent to this issue.)

  1. Do a regex search for this (but note the above):
    (\s)?\n(\s)?
     
    507132114_ScreenShot2020-03-24at10_50_44AM.png.ac21ad4c1afbca1b51dc4dc8b2464b2e.png
  2. Now select the same search from the list of recent searches. 

Result: the first part of the pattern is now dropped:

307412141_ScreenShot2020-03-24at10_50_57AM.png.033b8ef2345097c9c53aa50b16d71a0c.png

Link to comment
Share on other sites

Seems like it might be Mac-specific, as I don't get that truncation on Windows.

-- 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

I find that Publisher uses a Unicode 2029 (Paragraph Separator) instead of a carriage return, Unicode 000D or newline (I think) 000A. This is on Mac. The image is from text copied in Publisher and pasted into BBEdit.

877233949_ScreenShot2020-03-24at1_21_50PM.png.f94b8a00b6198f8bd305cef422da64ae.png

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.0 | Affinity Photo 2.4.0 | Affinity Publisher 2.4.0 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

That's interesting. If that's the case, my opinion on this is that Serif should still make \n work for newlines, even if they have to first swap out the \n in the search string for whatever character they actually use before passing the string on to whatever regex processing they do.

Link to comment
Share on other sites

1 hour ago, garrettm30 said:

If that's the case, my opinion on this is that Serif should still make \n work for newlines,

But \n matches paragraph breaks today. If they made it match a line-break then they'd need something else to match the paragraph breaks. And since paragraphs are the usual use for enter/return, it's more appropriate that \n match them than the relatively infrequent line-break, in my opinion.

-- 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

15 minutes ago, walt.farrell said:

But \n matches paragraph breaks today. If they made it match a line-break then they'd need something else to match the paragraph breaks.

That "something else" already exists: \r, which already matches paragraph breaks in Affinity as it should and as it does as elsewhere.

For what it is worth, the distinction between \n and \r is understood by InDesign. Not that I want to hold up InDesign as the master reference that Serif must adhere to if it is going to be successful, but it is to say that a lot of users are going to be accustomed to such usage.

But InDesign is not the only software where this works. I am accustomed to it in my own web programming, and notice the quick reference in my favorite regex tool (regex101.com):

285593123_ScreenShot2020-03-24at5_36_43PM.png.eff9d16022b1f487ad962d48cc44c6de.png

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.