Jump to content
Wojciech Krakowiak

[1.7.0.305] GREP & two following conjunctions

Recommended Posts

Here's the case: I want to place a non-breaking space before all conjunctions in document.

I use this GREP rule:
find: (\b)(a|i|o|u|w|z|A|I|O|I|W|Z)(\b\s)
replace: $2$3

Everything works fine until it meets two following conjunctions, like "i w". Then it changes this expression into "I", and the second conjunction "w" gets moved to the place of next conjunction in document and all following conjunctions in document get moved to the place of next conjunctions.

To clarify it, download Publisher document that I attach, use the mentioned grep rule and see what happens with all conjunctions.

I hope this is understandable :D

Without this fix, this GREP rule is useless in polish language, because we have a lot combinations like " i w ", " a w "

 

test.afpub

Share this post


Link to post
Share on other sites
2 hours ago, Wojciech Krakowiak said:

I want to place a non-breaking space before all conjunctions in document.

Hello @Wojciech Krakowiak.

Your find Grep adds space (not the non-breaking space) after the conjunction and not before.

I modified your grep slightly. Please test it now and let me know whether this works for you now.

FIND: \b(a|i|o|u|w|z|A|I|O|I|W|Z)\b\s

REPLACE: $1(add the non breaking space from the pop up menu)

 

Edit: This ads the non-breaking space after the conjunction. I think this is what you want.

Share this post


Link to post
Share on other sites
3 hours ago, Wojciech Krakowiak said:

(a|i|o|u|w|z|A|I|O|I|W|Z)

By the way, shouldn't that be (a|i|o|u|w|z|A||O|U|W|Z) instead?


-- Walt

Windows 10 Home, version 1903 (18362.239), 16GB memory, Intel Core i7-6700K @ 4.00Gz, GeForce GTX 970
Affinity Photo 1.7.2.471 and 1.7.2.464 Beta   / Affinity Designer 1.7.2.471 and 1.7.2.4464 Beta  / Affinity Publisher 1.7.2.471 and 1.7.3.475 Beta

Share this post


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

(a|i|o|u|w|z|A||O|U|W|Z)

Well spotted.

However, even this one has a small typo :-):

(a|i|o|u|w|z|A||O|U|W|Z)

Share this post


Link to post
Share on other sites
49 minutes ago, Seneca said:

Well spotted.

However, even this one has a small typo :-):

(a|i|o|u|w|z|A||O|U|W|Z)

I think there is a missing EYE in there.


MacBook Pro (13-inch, Mid 2012) Mac OS 10.12.6 || Mac Pro (Late 2013) Mac OS 10.14.5

Affinity Designer 1.7.2 | Affinity Photo 1.7.2 | Affinity Publisher 1.7.2 | Affinity Designer Beta 1.7.2.2 | Affinity Photo Beta 1.7.2.151 | Affinity Publisher Beta 1.7.2.458

Share this post


Link to post
Share on other sites
1 hour ago, Seneca said:

Well spotted.

However, even this one has a small typo :-):

(a|i|o|u|w|z|A||O|U|W|Z)

Almost. (a|i|o|u|w|z|A|I|O|U|W|Z)

Thanks. I knew I had messed it up, but thought I had fixed it before.


-- Walt

Windows 10 Home, version 1903 (18362.239), 16GB memory, Intel Core i7-6700K @ 4.00Gz, GeForce GTX 970
Affinity Photo 1.7.2.471 and 1.7.2.464 Beta   / Affinity Designer 1.7.2.471 and 1.7.2.4464 Beta  / Affinity Publisher 1.7.2.471 and 1.7.3.475 Beta

Share this post


Link to post
Share on other sites
Posted (edited)

You can use simpler expressions, and run it twice (for the second one in  "i w") :

_space_([aiouwzAIOUWZ])_space_

replace with:

_nobreakSpace_$1_space_

2019-04-27_093841.png.d75216ce12b58210bb256e84a38299b5.png

 

 

Comment: [abc]  expression will select a (ONE) character depending of the ones listed between the brackets, no need to use "or" (the "|").

Edited by Wosven
Added comment

Share this post


Link to post
Share on other sites
9 hours ago, Wojciech Krakowiak said:

wow, thanks for your interest and discussion.

The GREP below works for me.

I made the assumption that any 1 letter word needs to be connected to the next word. That pretty much covers all the cases:

FIND: \b(\w)\b\s

REPLACE: $1(non-breaking space)

Edit: Wait. This still moves the one letter words around. I definitely think that this is a bug.

Share this post


Link to post
Share on other sites

Hi guys! Thank you very much for your help with this! I've reproduced the issue - it seems to be gobbling up the first 'w' after the i and then replacing all the other single letter conjuctions shifted 1 letter along.

I'll get this passed on to development.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×