Copy link to clipboard
Copied
Is there a way to replace space with en space after bold using grep in paragraph style?
marked in yellow is just a (space)

and this should be the output using (en pace)

Copy link to clipboard
Copied
Is the space directly after the bold text styled in bold or regular font weight?
Copy link to clipboard
Copied
regular font
Copy link to clipboard
Copied
What exactly does that mean? Regular font?
Copy link to clipboard
Copied
Ah, if the font style for the space was also in bold, then the following would work as a single find/change command:

The font Times has both a “Bold” and “Regular” variant, where the find format uses Bold to only apply the GREP Find/Change to the space after the second word, but not in the Regular style/weight text.
Copy link to clipboard
Copied
In my tests the space after the bold text remains bold, even if I try to explicitly set it as regular weight (not using styles)… Are you sure that the space is not in bold weight? EDIT: I think that I had a style override issue from testing GREP paragraph styles, as I can now specify the space in regular after clearing the style.
Can you provide a sample file? It is pointless testing and offering further suggestions on docs that do not match yours.
Copy link to clipboard
Copied
You can't do EXACTLY what you're asking to do via a GREP style because GREP styles can only format the text that is there, not replace text with something else. You could do that with a GREP find/change but not with a GREP style.
That being said, you can pretty much do what you want with a slightly different approach. Create a character style and apply a horizontal scale value in that character style. Call it something like "stretch space" or whatever you like. Now, you can apply that character style to the space that follows the last bold character of the text with the "stretch space" effectively achieving the same result.
Now, how to isolate that space after the bold text 😉 That might get a little tricky. I'd need to see some actual examples of your content, but I'm thinking you might have better luck using a Nested Style vs. a GREP style.
Copy link to clipboard
Copied
Chad Chelius wrote
You could do that with a GREP find/change but not with a GREP style.
[…]
you might have better luck using a Nested Style vs. a GREP style.
I doubt Nested styles could help, because 'GREP styles can only format the text, not replace it with something else', as you said already. Nested styles have the same limitations. I'd use a Find/Change:
Find what: ^.+
Change to: $0@
Find Format:
Character style: bold (I'd recommend to use styles for any text formatting)
or just: + Bold (in case you don't use char style)
That said, we isolate first regular space after bolded text in the beginning of every paragraph, marking it with some special glyph (I used at sign here)
Now the 2nd Find/Change query:
Find what: @\s (at sign followed by a space)
Change to: ~> (en space)
Done.
Copy link to clipboard
Copied
Not truly relevant because the last "bold" char could alas be … a space!
Best,
Michel, for FRIdNGE
Copy link to clipboard
Copied
question in post 1, answer in post 3.
or you mean something different?
Copy link to clipboard
Copied
All know the enrichments application is not really always well done! …
So, a bad point to be taken in account in a Grep code!
Best,
Michel
Copy link to clipboard
Copied
Nothing is 'really always well done'. You always work with a given text. OP says a space after bold text is regular? OK, I play with this. Why I should take into account somewhat somewhere in some other texts may be not true? This regex isn't going to be carved in stone.
Is it still doable using F/C if format of that space varies? Sure, just a little bit trickier.
Should someone bother about it now? Nope.
It's a matter of view, after all. See no point to discuss this further.
Another thing, quite likely, totally different approach is possible, maybe even 'one-click'? Just share it, what the problem?
I'll be the first to 'like' it, promise ![]()
Copy link to clipboard
Copied
FWIW, the second take.
Still based on assumption the space to be replaced has no Character style applied and/or has Regular weight. You’ll just need to adjust Find Format settings accordingly.
Simple as that:
(?<!\S)\x{20}

Copy link to clipboard
Copied
… and how do you do if a the "bold" char style is applied to "event"?! …
Copy link to clipboard
Copied
And what if not? And what about your previous question about bolded 'last' space?
What if there is no other formatting at all except bold at the beginning of the paragraph, as it is shown in OP's sample?
I could continue endlessly myself, but, as Stephen_A_Marsh already said, it is pointless to guess at this stage.
Again, if you have in your hat a solution that covers all possible cases in one go, I'm all ears.
I know you're capable to do so much more than just ask silly questions.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more