Help with GREP search

New Here ,
Oct 21, 2020

Copy link to clipboard

Copied

I'm trying to make a plain text so, that I can batch process all the layout formatting in one go.

I'm using this now for the GREP search/replace:

(!CSNUM2!)(\w\s*.*)(!CSNUM2!)

Is there a way that I can add to this formula it would include a (hard) line break? For example, all text between !CSNUM2! needs to become Arial Narrow, 11pt:

!CSNUM2!This is a line.
This is a second line.

This is a third line.

And so on!CSNUM2!

 

 

I've tried this on a document, but it applies the search/replace only to single lines.
I've also tried to add the multiline on (?m), but that doesn't work. Adding a forced line break \n to the code doesn't work, neither does the standard carriage return ~b.

 

Having to put the !CSNUM2! before and after every single line is going to take so much time that I can just go through the whole text by hand.

 

Any pointers?

TOPICS
How to, Scripting

Views

136

Likes

Translate

Translate

Report

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

1 Correct Answer

Advocate , Oct 22, 2020
FRIdNGE Advocate , Oct 22, 2020
The 2nd term between parenthesis of your Grep code has to be: \X+? (^/)  The Jedi

Likes

Translate

Translate
Jump to answer Jump to answer
Advocate ,
Oct 21, 2020

Copy link to clipboard

Copied

Use single line modifier at the begining...

(?s)

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Advocate ,
Oct 21, 2020

Copy link to clipboard

Copied

You might also want to try this one:

(!CSNUM2!)(\X+)(\1)

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
arnoenzo AUTHOR
New Here ,
Oct 21, 2020

Copy link to clipboard

Copied

Neither of these seem to work.
I don't know if it makes a difference to the response, but in the replace box I have $2 and a paragraph style set to change into.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Advocate ,
Oct 22, 2020

Copy link to clipboard

Copied

The 2nd term between parenthesis of your Grep code has to be:

 

\X+?

 

(^/)  The Jedi

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
arnoenzo AUTHOR LATEST
New Here ,
Oct 22, 2020

Copy link to clipboard

Copied

Lifesaver! Thank you so much!

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Oct 22, 2020

Copy link to clipboard

Copied

As so often, you can use different expressions for this. Apart from what Jean-Claude suggested (and Michel's correction) you can use a negative character class:

 

(?s)!CSNUM2!.+?!CSNUM2!
!CSNUM2!\X+?!CSNUM2!
!CSNUM2![^?]+?!CSNUM2!

 

P.

Likes

Translate

Translate

Report

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