• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to apply a GREP style to a name at the end of a para in a caption.

Community Beginner ,
Sep 13, 2017 Sep 13, 2017

Copy link to clipboard

Copied

I can't figure out how to apply a GREP style to my Paragraph style to make the name after the end of the paragraph bold. The name could have a dot in it, or two dots and it could be anything from 1 to 100 characters long. Can you help, here's an example "The imposing 1904 NER.... to colour lights. M.Rhodes

Views

2.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Jul 18, 2018 Jul 18, 2018

Basically, you need to catch the last sentence? Well, there’s no universal definition for *sentence* in GREP.

These expressions will catch the longest possible run at the end of a paragraph that does not contain a period, or question, or exclamation mark (one of a possible *sentence* definitions).

If there’s no punctuation at the very end, this one is enough:

[^.?!]+$

This one will take care about .?! at the end of the last sentence, too:

[^.?!]+[.?!]?$

However, both fail with samples like this:

Taxes

...

Votes

Translate

Translate
Mentor ,
Sep 13, 2017 Sep 13, 2017

Copy link to clipboard

Copied

So, that 'name after the end of the paragraph' may or may not have in it: upper and lower case letters, dots, spaces (I assuming it since it may be up to 100 chars long)... Combination dot+space inside 'the name' also possible? Is there any formal difference from the rest of the text?

It seems to me like "Heather, Peter, Jennifer" - can you tell boys from girls with a GREP?

I'd be happy to be corrected, though

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 13, 2017 Sep 13, 2017

Copy link to clipboard

Copied

Here are some examples from the captions I have

F.F.P. Media

M.Jamieson

P.Shannon & N.Allsopp

Both D.Allen

D. Allen (2)

So as you can see there are quite a few variations, dots, spaces, ampersands, special characters perhaps maybe even the odd glyph character like ü or é.  I was hoping to be able to use something like this

\Z(?<=).~.

but I'm not getting any results, I've already got a paragraph style and a character style all set up. My GREP for the beginning of the paragraph works, that apply the same character style 'bold green italic' to this string

.+(-~>)

That basically is used if I need to indicate an image Above-, Left-, Right- or Below-

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Sep 13, 2017 Sep 13, 2017

Copy link to clipboard

Copied

Well, this pretty simple one seems to work on my side, exactly on your given samples:

\.\s\K(\u\.)+.+

Let’s give it a try and see what happens.

The code is not bullet proof at all, it highly depends on your actual text.

There still may be false positives and negatives.

Try and come back with comments!

Imposing.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

This is working for most of the names, some it doesn't but if it captures say, 80% that cut's down my work and I only have to manually apply the style to the ones that it misses.

An example of 1 that didn't work is:

. both FFP Media

Thanks for your help, it's saved me a lot of time, the book will be 288pages!

S

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

This updated regex will catch cases like . both FFP Media, too:

\.\s\K(both\s|(\u\.)+).+

But only with both, not any other word! Is it sufficient?

As I said earlier, without knowing how actual text looks... etc.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

This might sound like a daft question, but... is there any chance that the text before the "names" never contains any full stop, except the one at the end?

If that so, you might think the other way round and applying a nested style would just be sufficient...

It's probably to easy to be true, but it's worth asking...

dots.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

This is a specific example where it didn't work.

The 1961 box at Colwich, built at the time of electrification and resignalling of the WCML closed and the work of it’s 40 levers was added to the Stoke signalling centre. FFP Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

Really? It does work for me...

By the way, can you be more specific about your workflow to create those captions? Do you use Metadata variables, dynamic or static captions?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

Aha!  Once again: Variable!? 

By Security, Grep style:

Bold

~v$

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

Aha!  Once again: Variable!? 

?

Pas compris là...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

No The caption aren't in the metadata, the author has just supplied these in word and I have to copy paste them across, so they're Static captions. I've applied an object style that applies the para style to the box and the grep hopefully catches most of the styling in there for Right- Text in Caption. Author. of Image

At the moment with you're help it's capturing 90% of the image authors which is fab, the others I'm manually styling.

Sorry I don't understand the Variable!?  By Security, Grep style: Bold ~v$ (^/) bit, I wish I did.

S

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

OK no variables then...

But I don't understand why your last example doesn't work.

Can you make sure no character style is applied?

Can you share the result?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 15, 2017 Nov 15, 2017

Copy link to clipboard

Copied

Hi fidgetyfishPLATFORM,

I would like to know if the steps suggested above worked for you, or the issue still persists.

Kindly update the discussion if you need further assistance with it.

Thanks,

Srishti

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Only this worked

\.\s\K(Both\s|(\u\.)+).+

nothing else did, I have another book, similar issue. this time around, the above didn't work and neither did this

\.\s\K(\u\.)+.+

This time the captions are not as similar, here's a page that gives you an idea, I've manually applied the character style to the highlighted areas but really I want a GREP solution for this as I know the book will be around 300pages at the end.

Can anyone help?

Screenshot 2018-07-18 12.54.12.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

Basically, you need to catch the last sentence? Well, there’s no universal definition for *sentence* in GREP.

These expressions will catch the longest possible run at the end of a paragraph that does not contain a period, or question, or exclamation mark (one of a possible *sentence* definitions).

If there’s no punctuation at the very end, this one is enough:

[^.?!]+$

This one will take care about .?! at the end of the last sentence, too:

[^.?!]+[.?!]?$

However, both fail with samples like this:

Taxes raised by 30.5%!

You’ll catch only 5%! using the second regex, and nothing at all using the first.

Not a good solution for exercise book, but may work well enough for actual job.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 19, 2018 Jul 19, 2018

Copy link to clipboard

Copied

LATEST

The 1st option [^.?!]+$ does what I need it to do so thanks, that was very helpful. I wish I understood GREP expressions better, they're so useful.

Sarah

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 18, 2018 Jul 18, 2018

Copy link to clipboard

Copied

What about manually putting in a non printing character like a non-breaking space in between the caption and the name, then formatting your grep to say find the nbsp and change everything to the end of the paragraph to this format? (Sorry no help with the actual grep code for this)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines