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

Finding double spaces works poorly


Recommended Posts

I have been trying to find and replace double spaces in the text with single spaces.

I am finding that the search feature is very hit and miss. I continually find double spaces while eyeballing the text which I have to correct manually.

Is there some reason the search feature is missing so many?

I have found this in searching for other things as well. Is this feature still under development?

Thanks

Link to comment
Share on other sites

Here's one reason that might happen, @gumbo23.

Suppose you have a string with 3 spaces, such as

ABC   DEF

And suppose you do a Find for "  " (2 spaces) and replace with 1 space.

Your Find operation generates a results list, where the list contains 1 entry, "ABC   DEF" with the first 2 spaces selected.

The Replace will replace those 2 spaces with 1 space. But now you still have

ABC  DEF

with 2 spaces (the one you added, and the original one that your Find operation didn't select). So you would need to do another Find.

Or, to make it easier, you need to use Regular Expression searching. Find

 {2,}

(that's " {2,}") and replace with a single space.

Or, if you want to cover all kinds of whitespace (non-breaking spaces, tabs, narrow spaces, etc.) use "\s{2,}" as the search term.

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

5 minutes ago, gumbo23 said:

Use this exactly?

I tried, but it found nothing - though I know there must be dozens more cases in the doc.

 

Yes, that exactly. It will find any combination of 2 or more whitespace characters.

But, perhaps you don't have the Regular Expression option enabled? That seems to be the default for me, but check your Find options using the gear/cog icon to the right of the Find box.

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

1 minute ago, walt.farrell said:

Yes, that exactly. It will find any combination of 2 or more whitespace characters.

But, perhaps you don't have the Regular Expression option enabled? That seems to be the default for me, but check your Find options using the gear/cog icon to the right of the Find box.

I tried it both ways, with no joy.

I have the latest version installed. 

Any other thoughts?

Link to comment
Share on other sites

11 minutes ago, gumbo23 said:

Any other thoughts?

Please show a screenshot of the Find panel, and the Find options.

Also, if you can provide a sample .afpub file that would be helpful.

 

-- 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 can you put a link here, where I can find some help about RegEx used in Publisher? Thanks in advance.

All the latest releases of Designer, Photo and Publisher (retail and beta) on MacOS and Windows.
15” Dell Inspiron 7559 i7 Windows 10 x64 Pro Intel Core i7-6700HQ (3.50 GHz, 6M) 16 GB Dual Channel DDR3L 1600 MHz (8GBx2) NVIDIA GeForce GTX 960M 4 GB GDDR5 500 GB SSD + 1 TB HDD UHD (3840 x 2160) Truelife LED - Backlit Touch Display
32” LG 32UN650-W display 3840 x 2160 UHD, IPS, HDR10 Color Gamut: DCI-P3 95%, Color Calibrated 2 x HDMI, 1 x DisplayPort
13.3” MacBook Pro (2017) Ventura 13.6 Intel Core i7 (3.50 GHz Dual Core) 16 GB 2133 MHz LPDDR3 Intel Iris Plus Graphics 650 1536 MB 500 GB SSD Retina Display (3360 x 2100)

Link to comment
Share on other sites

31 minutes ago, Petar Petrenko said:

can you put a link here, where I can find some help about RegEx used in Publisher?

This is the documentation that is specific to the library that Publisher uses, I think: https://www.boost.org/doc/libs/1_73_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html

There are lots of other documentation sites for regular expressions, of course, including this one for the Python implementation, which I also use: https://docs.python.org/3/library/re.html?highlight=re#module-re

 

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

On 6/23/2020 at 9:40 PM, Petar Petrenko said:

a link here, where I can find some help about RegEx used in Publisher?

You also might like  http://regexlib.com/Search.aspx  which doesn't list syntax only but also includes many samples of complex expressions, shows comparisons of results which are affected towards those which aren't (Matches / Non-Matches) and offers a test area. – Though not all of them may fit to the specific RegEx used in APub it can be helpful.

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Link to comment
Share on other sites

I found this book on the internet:

https://www.princeton.edu/~mlovett/reference/Regular-Expressions

is the sintax used in it valid for use in Publisher?

All the latest releases of Designer, Photo and Publisher (retail and beta) on MacOS and Windows.
15” Dell Inspiron 7559 i7 Windows 10 x64 Pro Intel Core i7-6700HQ (3.50 GHz, 6M) 16 GB Dual Channel DDR3L 1600 MHz (8GBx2) NVIDIA GeForce GTX 960M 4 GB GDDR5 500 GB SSD + 1 TB HDD UHD (3840 x 2160) Truelife LED - Backlit Touch Display
32” LG 32UN650-W display 3840 x 2160 UHD, IPS, HDR10 Color Gamut: DCI-P3 95%, Color Calibrated 2 x HDMI, 1 x DisplayPort
13.3” MacBook Pro (2017) Ventura 13.6 Intel Core i7 (3.50 GHz Dual Core) 16 GB 2133 MHz LPDDR3 Intel Iris Plus Graphics 650 1536 MB 500 GB SSD Retina Display (3360 x 2100)

Link to comment
Share on other sites

48 minutes ago, Petar Petrenko said:

I found this book on the internet:

https://www.princeton.edu/~mlovett/reference/Regular-Expressions

is the sintax used in it valid for use in Publisher?

Probably valid (as it's for Perl Compatible Regular Expressions), but as it's from 2007 it's perhaps incomplete and missing some aspects of the Boost RegEx engine that support functions developed in the last 13 years. The differences are likely small, but potentially significant. So if you try something in it and it doesn't work quite as you expect, I would compare it with the Boost documentation. Also, there may be aspects of RegEx syntax/function from those 13 years that may make some functions easier, or possible, that weren't back in 2007.

It's probably a good start if you're not already a RegEx expert :)

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

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

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.