Skip to main content
Participant
November 26, 2024
해결됨

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

  • November 26, 2024
  • 1 답변
  • 841 조회

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.

이 주제는 답변이 닫혔습니다.
최고의 답변: brian_p_dts

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?


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

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

C: $2$1

1 답변

James Gifford—NitroPress
Legend
November 26, 2024

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?

brian_p_dts
Community Expert
Community Expert
November 26, 2024

Using James' idea, you can use GREP: 

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

Change: $2$1

meilech12작성자
Participant
November 27, 2024

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?