How create a "Return to the Line" / "Carriage Return" in a "Style GREP" replacement

Explorer ,
Dec 17, 2021 Dec 17, 2021

Copy link to clipboard

Copied

Hi everyone,

I'm looking something a bit complicated I think.

I'm using a Data Merge file, and I use the Style GREP for replacing some "styles" (like replacing the size, the contour and the color of some words or ligatures).

This work(s?) very well, but... I cant return to the line / carriage return with this technic, since I can only write on one line of text.

Any idea ?

Maybe I can replace a chain of character which will be understood by the software as a Carriage Return ?

TOPICS
Feature request , How to , Import and export , Scripting , Sync and storage , Type

Views

466

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
Adobe Community Professional ,
Dec 17, 2021 Dec 17, 2021

Copy link to clipboard

Copied

You're looking for "Single-Line Mode" as described here in Peter Kahrel's GREP in InDesign. A query of (?s).+ will select everything in every line to the end of a story, even when it's the query in a GREP Style. I am actually aa bit surprised that it'll work for you, as I didn't expect a GREP Style defined in a paragraph style to continue affecting text after the end of the paragraph. But it absolutely does! 

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
Adobe Community Professional ,
Dec 18, 2021 Dec 18, 2021

Copy link to clipboard

Copied

Hi Joel. It shouldn't, and doesn't when I tried. It may look as if it works if all the paragraphs in the story use the same paragraph style.

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
Explorer ,
Dec 18, 2021 Dec 18, 2021

Copy link to clipboard

Copied

Indeed, I tested, and, I dont understand the "Single-line and Multiline" thing.

 

03-grep-indesign-paragraph-style-metacharacters.jpg

 

I can say "if END OF PARAGRAPH, then apply a style X", but nothing related to a carriage return.


NOTA BENE : I wrote "Style GREP" but it's "GREP Style" in the software in english, of course.

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
Adobe Community Professional ,
Dec 18, 2021 Dec 18, 2021

Copy link to clipboard

Copied

Well, first off, I suggested single-line mode because I complely misunderstood what you were asking for. I then performed a test at home that I botched. (Turns out, Peter, that my test had the first line of text on Style 1, and all the rest of the text in Style 2... but I neglected to notice that I based Style 2 on Style 1. So, when I made my test GREP Style in Style 1, it automatically propogated into Style 2, which applied it to all of the text in my test, instead of just the first line. Whoops!) 

 

Anyhow, I can see that your GREP query is meant to select four digits, but I suppose I still don't understand what you are looking for. You can, in fact, specify the linefeed/carriage return character, which is "End of Paragraph" in that flyout menu, and represented by the blue pilcrow when you have Type -> Show Hidden Characters turned on:

findcrlf.gif

 

So, /r finds the end of the paragraph, including the CR/LF. However, if you were looking for the location of the end of the paragraph, not the pilcrow/carriage return/etc, I think you'd use $, which is located in the Locations -> End of Paragraph in the flyout. Note that they have identical names in the flyout, but have different symbols in your regular expression:

 

findendofp.gif

 

See how it doesn't acutally select the pilcrow character? It only puts the cursor at the place where the paragraph ends. If I were naming these things in the flyout, I would have named 'em differently. 

 

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
Explorer ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

Hi Joel, this is the Find & Replace tool that you are showing to me, which is using the GREP technology, between others things, not the GREP Style tool (I did show you the tool).

 

With the F&R tool, you cant modify a database chain of character, since the chain is called between <<>>. 

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
Adobe Community Professional ,
Dec 18, 2021 Dec 18, 2021

Copy link to clipboard

Copied

Nemesis -- What exactly do you mean by 'I cant return to the line / carriage return'?

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
Explorer ,
Dec 18, 2021 Dec 18, 2021

Copy link to clipboard

Copied

When I write "I cant return to the line / carriage return with this technic, since I can only write on one line of text", this mean, in a field of a database, you can only write a chain of characters, but "return to the line / carriage return" is/are not "character(s)".

I will try the technic of Peter K., thx Joel.

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
Adobe Community Professional ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

I still don't understand wat you want, Nemesis. Please post an example of a paragraph that you want to target and what you want to do with it.

Joel used the F&R window only to demonstrate how \r and $ work. The expressions you use in the F&R window are the same as those that you use in the Grep style window.

 

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
Explorer ,
Dec 28, 2021 Dec 28, 2021

Copy link to clipboard

Copied

Indeed, I didnt answer but it cant work with the F&R tool.

So, let's take a field of a database :

 

"This is an example of sentence. Everything is on the same line. Of course, it's a chain of character."

Let's imagine that the column is named "example", the raw text written will be <example>.

I would like to be able to convert some character (for example) into carriage return. With the F&R tool, it works only with raw text.

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
Adobe Community Professional ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

pixxxelschubser_0-1639916043108.png

 

… I can say "if END OF PARAGRAPH, then apply a style X", but nothing related to a carriage return …


By @Nemesis666first

                                                                                     --> jump to quoted post

 

If I understand this correctly:

Instead of "end of paragraph", just try to format the last character before "end of paragraph".

e.g.

.(?=\r)

or

.(?=$)

or

.\r

or

.$

 

Very important:
Grep styles can only format characters but NOT replace them!

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
Explorer ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

Hmmmm, in fact, you can, but its a bit complicated : i used the ligature system and created my own font made of symbols and/or letters to be able to do it 😛 .

 

Okay, so you think i cant do it with the   GREP Style system... Hmmmm. 

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
Adobe Community Professional ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

Well, that's very clever! But you're not actually altering the series of characters that are stored in your file, only causing them show different contextual alternates, right? So yeah, you absolutely could do that with a GREP Style. 

 

Since you have a fairly complex workflow, mabye you should go back to the beginning of your question and describe everything, as we have some fairly sophisticated users in your thread who can't figure out your workflow with the information you've given us. 

 

Also: upthread, you mentioned that "you cant modify a database chain of character, since the chain is called between <<>>. " Do you mean the Data Merge placeholders for the fields for the data merge? Right now, my guess is that you want the GREP style to apply a highlight to four-digit numerals inside the placeholders? Before you've run the merge? So sorry to say this again, but can you please give us a verbose explanation of your workflow and your goals for your document, post-merge?

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
Explorer ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

Okay, I will give more details :

I'm using a Data Merge file, this mean all the content are stored in a Data Base file, I cant modify the text inside the document in an other way than to modify the Data Base file.

The only way to do that is to use GREP Styles (not the Find & Replace tool, the GREP Style tool which is inside the paragraph style thing), which can modify things like "contour", size of some words, conditionnal size of texte if a number of character is detected in the field called from the data base, etc...
But I cant use multiline, since a field of a data base cant hold a carriage return feature.

How could I introduce a kind of carriage return using GREP Style. I fought about converting a chain of character into a code, like "1234" becoming "\alt+254" or something like that. Any idea ?

That's done, is it more clear 😛 ?

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
Adobe Community Professional ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

You can't replace characters with Grep styles, all you can do is change their appearance. This was mentioned earlier in this thread (see the red text).

 

is it more clear

Not really. Show us examples.

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
Explorer ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

Yes, you can change their appearance, but if I remember well, if I create a custom ligature of "xyz" into an "abcd" set of characters, and I ask to GREP Style to search for "abcd", it will find "abcd" as it was the default text.

I dont remember, I used a website to create custom font with ligature system, I have to retrieve this site.

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
Explorer ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

Hmmm, IcoMoon was the website used for symbols, and it seems that ligatures are considered as "icons"/"symbols", not as letters, it's logic now that I am thinking about it.

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
Adobe Community Professional ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

Okay, we still don't know what you actually want, but I think we're getting closer. You have numerous fields in a multiple-record layout, right? And they're coming into the merge all in one frame, as a single paragraph, and you want each one on its own line? And so you want to figure out how to add a CR/LF at the end of each field? But you don't want to go through your document whacking the Enter key hundreds of times, so you want to figure out a way to automate it. 

 

How'd I do? That is my best guess. It's probably wrong, I know, but that's the kind of explanation that I'm hoping to get from you. If you can't tell us what you hope to get by Doing The Impossible (adding a carriage return at the end of a Data Merge field, using only GREP Styles) then we can't make any alternate suggestions. As has been said more than once upthread, you are not going to be able to add any characters with a GREP Style. 

 

I mean, you're in the right place if you are looking for a regex solution for a sticky InDesign problem. The solution that you're currently using, if I understand it, is that you've made a custom font that uses contextual alternate lookups to alter the appearance of the stuff coming in from the data merge. That is, like I said before, quite clever, but I don't think that continuing along those lines is going to lead you to a solution.  Can you post some screenshots? Can you post a sample INDD file? Being able to see what you're trying to do will help us figure out what suggestions we can make.

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
Explorer ,
Dec 28, 2021 Dec 28, 2021

Copy link to clipboard

Copied

"But you don't want to go through your document whacking the Enter key hundreds of times, so you want to figure out a way to automate it."

It's not that I dont want, again, in a field of a database, you CANT physicaly type a Return Cariage since it's a monolythic chain of character.

I gave an example to Peter Kahrel, I will just copy it here :

Let's take a database with only one column named "example", let's Data Merge it by writing the raw text "<example>" in a text zone.
On the first entry of this database, imagine we did write :

 

"This is an example of sentence. Everything is on the same line. Of course, it's a chain of character."

I would like to be able to convert some character (for example) into carriage return.

I cant be more precise than that, I think you all know what is a Data Merge, so, I dont know what I could show 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
community guidelines
Adobe Community Professional ,
Dec 29, 2021 Dec 29, 2021

Copy link to clipboard

Copied

Choose any kind of reserved phrase or coding in the data source (ie: <<rtn>>) and replace with an actual return mark after the merge? It can't be done with GREP style. 

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
Explorer ,
Dec 29, 2021 Dec 29, 2021

Copy link to clipboard

Copied

F&R can only see <example>, it cant read the chain of character.

The GREP Style can read the chain of character, but it seems it cant replace a set of character by a "return mark".

I will check by writting <<rtn>> in the source but it's probably not what you tried to explain to me.

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
Adobe Community Professional ,
Dec 29, 2021 Dec 29, 2021

Copy link to clipboard

Copied

Run F&R after you have executed the merge on the created documents. 

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
Explorer ,
Dec 29, 2021 Dec 29, 2021

Copy link to clipboard

Copied

I confirm, F&R cant read <<rtn>>, and obviously it's not automaticaly replaced by a carriage return, it's not what you wanted to say, I know 😛 , I was just making the test to be sure xD .

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
Adobe Community Professional ,
Dec 29, 2021 Dec 29, 2021

Copy link to clipboard

Copied

What do you mean by 'the chain of character'? You still haven't shown any real example of what your output is and what it should look like after the change.

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
Adobe Community Professional ,
Dec 29, 2021 Dec 29, 2021

Copy link to clipboard

Copied

If you are only in Preview mode of DataMerge, then yes, you would be able to see GREP style replacements. What you are after cannot be done with GREP Style. You need to execute the merge and run F&R on the actual merged document(s) to change instances of <<rtn>> to a carriage mark. 

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