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

Moving a comma/period from the beginning of the paragraph to the end

Community Beginner ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

I have a whole bunch of text where the punctuation got messed up and the commas and periods are at the start of the line/paragraph, instead of the end. I have the same issue with ... but those are rare.

I'm looking for a script or a trick to fix all the text at once.

TOPICS
Scripting

Views

153

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

Community Expert , Nov 26, 2024 Nov 26, 2024

Oh. If you want to move paragraph to end of it's current line, the GREP is:

F: ^(\.+|,)([^\r]+)

C: $2$1

Votes

Translate

Translate
Community Expert ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

An example would help, here, if you can share a snip of the text. But I'm having trouble envisioning a situation where a period, a comma or an ellipsis is "at the wrong end" in any consistent fashion that would lend itself to Find/Replace or GREP.

 

You could, for example —

  • Find/Replace all periods with nothing.
  • Find/Replace all paragraph ends (^p) with period-para (.^p)

 

...and so forth. But that assumes a lot of consistency of the formatting all the way through, with (for example) no periods except at the beginning and to be moved to the end of a paragraph.

 

Is it possible to back up and get cleaner copy to start with?


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

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 Beginner ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

Thank you for the quick reply!

It's song lyrics, which is why some lines finish with a comma, some with a paragraph, and some don't have any punctuation.

Here is an example:
We are one
,since way back in time
.Unified at our start
,We began as a nation to live
.And believe with one heart

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 ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

I'd bet money that your text has accidentally had right-to-left text direction applied (it's trying to treat those commas and periods and ellipses as if they were Arabic). I assume that you have plain-vanilla English InDesign installed, and don't have these buttons on your Paragraph panel?

 

 rtl.png

 

If you do, you can just switch back to left-to-right paragraph direction. But this spontaneous right-to-left setting bug does occasionally happen to users of English-localized ID. If you've used paragraph styles, it's easy to resolve by switching from the World-Ready Composer (which supports RTL scripts like Arabic and Hebrew) to the normal Adobe Paragraph Composer (which does not). 

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 ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

In which languz is the text? If it is Western or European Text, go to the paragraph style settings and change from a World Composer to Adobe Paragraph Composer. 
it is found in Paragraph fine tuning. 

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 ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

Using James' idea, you can use GREP: 

Find: (\r)(\.+|,)

Change: $2$1

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 Beginner ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

Your find suggestion does a great job finding the punctuation, but change moves up the punctuation to the previous line, instead of moving it to the end of its current line.

Maybe there is a way to do 3 groups,
1 - the punctuation,
2 - all the text till the end of the paragraph
3 - the paragraph break
and exchange group 3 with 1 

After that we can do you previous suggestion to move it up to the previous line.
Is this doable?

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 ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

Oh. If you want to move paragraph to end of it's current line, the GREP is:

F: ^(\.+|,)([^\r]+)

C: $2$1

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 Beginner ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

Thank you so much! This finally worked.

I'd be happy if you'd explain the codes you used in the find

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 ,
Nov 26, 2024 Nov 26, 2024

Copy link to clipboard

Copied

LATEST

^ = start of line.

 

\.+ means one or more periods. We use backslash to escape period, which when unescaped means any character

 

| means or

 

, means comma

 

[^\r]+ means any number of characters that are not a return

 

Wrapping the two expressions in parentheses means we can references them in the change as $1 and $2. In this case, we reverse the two sets of finds

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