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.
Oh. If you want to move paragraph to end of it's current line, the GREP is:
F: ^(\.+|,)([^\r]+)
C: $2$1
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 —
...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?
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
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?
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).
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.
Copy link to clipboard
Copied
Using James' idea, you can use GREP:
Find: (\r)(\.+|,)
Change: $2$1
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?
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
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
Copy link to clipboard
Copied
^ = 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