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

Multiple GREP assistance with postivie look ahead in para styles

Engaged ,
Feb 02, 2024 Feb 02, 2024

Copy link to clipboard

Copied

I'm trying to match the following in a couple of grep styles in the same, single paragraph style:

 

Format:

Artist Songname (date)

Lots more text that needs to be unstyled like the date above.

 

text + endash + text (date)

text

 

Example:

Bob Dylan I Don't Believe You (She Acts Like We Have Never Met) (1964)

I can't understand
She let go of my hand
And left me here facing the wall

 

I'm trying to style the 'singer' name with this (seems to be working fine):

(?s).*~>

 

and the song title with this (but I don't think it's right):

(?s)(?<=~>).*(?<=\()

 

How do I capture the song title, which could contain parentheses, but not the parenthesised date? 

 

I also keep accidentally capturing the opening parenthesis of the date in my positive look ahead.

 

I was thinking along the lines of a positive lookahead that includes \([0-9]{,4}\) but it doesn't seem to work.

Any and all help appreciated!

TOPICS
How to , Type

Views

126

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 Expert ,
Feb 02, 2024 Feb 02, 2024

Copy link to clipboard

Copied

One help could be to start with a Paragraph style that is set in italic. Everything in the line would be italic. 

A grep could set the artist name in Bold (you state this appears to work fine). Also, a nested style might do this, too.

That just leaves the end of the line to be grepped to be Regular (aka Roman). Maybe something like: \((\d{4})\)

 

Mike Witherell

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 Expert ,
Feb 04, 2024 Feb 04, 2024

Copy link to clipboard

Copied

You have used lookbehind in (?s)(?<=~>).*(?<=\()

Doesn't this (?s)(?<=~>).*(?=\() work for you? Seems to work for me, see the screenshot.

Screenshot 2024-02-04 at 5.49.39 PM.png

-Manan

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 Expert ,
Feb 04, 2024 Feb 04, 2024

Copy link to clipboard

Copied

I am not a GREP Expert so I look for things that make finding the breaks easier, and because names and song titles can vary in word and character counts, I think you will have trouble with GREP searches that try to identify them using spaces.

An alternative would be to add some sort of tag you can add to separate the parts of the paragraph, and InDesign actually has a built-in tag that should work perfectly here: End Nested Style.

It has no width and is invisible so it won't affect your text flow, and it does not require the use of GREP at all, just ordinary nested styles in your paragraph style definition.

I don't know how you are getting the text into InDesign, but if you are using Data Merge you can modify your template to include the tags.

This won't be much help, unfortunately, if you are trying to style an existing text since automating the insertion of the tags is essentially the same problem as doing the styling.

 

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
Engaged ,
Feb 12, 2024 Feb 12, 2024

Copy link to clipboard

Copied

LATEST

Thanks Peter. I'll investigate 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