Highlighted

GREP expression to italicize not working with forced line break

New Here ,
Aug 31, 2020

Copy link to clipboard

Copied

I am working on a variable data (XMPie) job, and the data has <i>...</i> tags in it which I am using to italicize text in the middle of a paragraph. I am using the grep expression:  (?<=<i>).*(?=</i>) to locate the tags and italicize the content between them. It works great, except when a forced line break happens between the tags. When that happens this grep expression stops working. Any thoughts on how I can fix this?

<i>\K\X*?(?=</i>)

 

(^/)  The Jedi

TOPICS
How to, Scripting

Views

101

Likes

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

GREP expression to italicize not working with forced line break

New Here ,
Aug 31, 2020

Copy link to clipboard

Copied

I am working on a variable data (XMPie) job, and the data has <i>...</i> tags in it which I am using to italicize text in the middle of a paragraph. I am using the grep expression:  (?<=<i>).*(?=</i>) to locate the tags and italicize the content between them. It works great, except when a forced line break happens between the tags. When that happens this grep expression stops working. Any thoughts on how I can fix this?

<i>\K\X*?(?=</i>)

 

(^/)  The Jedi

TOPICS
How to, Scripting

Views

102

Likes

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
Aug 31, 2020 0
Adobe Community Professional ,
Aug 31, 2020

Copy link to clipboard

Copied

Have you tried:

(?<=<i>).*\n?(?=</i>)

Mike Witherell

Likes

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
Reply
Loading...
Aug 31, 2020 0
New Here ,
Aug 31, 2020

Copy link to clipboard

Copied

Yes. Just did. Does not work. Here is the story text...

 

<i>“Stay close to my light. You don’t want to get lost on the rocks.”

—Fejenar, Silundi lullmage</i>

 

The forced line break happens after the close quote, and before the em-dash. Everything works great if the forced line break isn't in there. Add it, and the grep expression isn't found.

Likes

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
Reply
Loading...
Aug 31, 2020 0
Adobe Community Professional ,
Aug 31, 2020

Copy link to clipboard

Copied

Hmmm. Did you try:

(?<=<i>).*\R?(?=</i>)

Mike Witherell

Likes

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
Reply
Loading...
Aug 31, 2020 0
New Here ,
Aug 31, 2020

Copy link to clipboard

Copied

Yes, actually, I tried that immediately following your suggestion:  (?<=<i>).*\n?(?=</i>)

 

Also does not work. 😞

Likes

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
Reply
Loading...
Aug 31, 2020 0
Adobe Community Professional ,
Aug 31, 2020

Copy link to clipboard

Copied

How about 

(?<=<i>).*?\R*.*?(?=</i>)

-Manan

Likes

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
Reply
Loading...
Aug 31, 2020 0
New Here ,
Aug 31, 2020

Copy link to clipboard

Copied

YES!!! That worked!

Thank you!

Likes

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
Reply
Loading...
Aug 31, 2020 0
Advocate ,
Aug 31, 2020

Copy link to clipboard

Copied

Use single line mode:
(?s)(?<=<i>).*?(?=</i>)

Or this:

(?<=<i>)(.*?\n?)*(?=</i>)




Likes

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
Reply
Loading...
Aug 31, 2020 3
Advocate ,
Aug 31, 2020

Copy link to clipboard

Copied

<i>\K\X*?(?=</i>)

 

(^/)  The Jedi

Likes

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
Reply
Loading...
Aug 31, 2020 3
Advocate ,
Aug 31, 2020

Copy link to clipboard

Copied

Shorter is better! 🙂 

Likes

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
Reply
Loading...
Aug 31, 2020 1
Adobe Community Professional ,
Aug 31, 2020

Copy link to clipboard

Copied

What does \X refer to/define as? Is it for everything?

Mike Witherell

Likes

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
Reply
Loading...
Aug 31, 2020 0
Advocate ,
Aug 31, 2020

Copy link to clipboard

Copied

Likes

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
Reply
Loading...
Aug 31, 2020 1
FRIdNGE LATEST
Advocate ,
Sep 01, 2020

Copy link to clipboard

Copied

… More precisely:

 

"Pluralitas non est ponenda sine necessitate." [Ockham, 1319]

 

😉

Likes

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
Reply
Loading...
Sep 01, 2020 0