GREP: Add line break after every 300th character?

New Here ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

I have a very large block of monospaced text that has no spaces (this is deliberate!). My goal is to have the characters all line up neatly across the page. By default InDesign seems to vary the line character count per line based on its own rules regardless of if the para is left aligned or force justified, so I’d like to take control of that and limit the text frame to exactly 300 characters and then have a line break. Can anyone think of a solution? I have a hunch the answer lies in some GREP magic. I have the ‘GREP in InDesign’ book but can’t find any hints about how to instruct something so specific as ‘find every 300th character (including slashes, numbers, punctuation etc) and add a line break.’

Screen-Shot-2022-05-28-at-11.31.15-AM.jpg

TOPICS
How to

Views

43

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
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , May 27, 2022 May 27, 2022
Try the following. Find What: .{300} Change to: $0\n Here . matches any character. The number inside {} specifies the number of characters to match. $0 is the match found -Manan

Likes

Translate

Translate
Adobe Community Professional ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

Try the following.

 

Find What: .{300}
Change to: $0\n

 

Here . matches any character. The number inside {} specifies the number of characters to match. $0 is the match found

-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
community guidelines
New Here ,
May 27, 2022 May 27, 2022

Copy link to clipboard

Copied

LATEST

Amazing! Thank you 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
community guidelines