2

I have an InDesign CS6 document with a lot of numbered paragraphs. They begin with a number and end with a paragraph mark. However, there are some paragraphs which have unwanted paragraph marks in the middle.

Question: how do I find these unwanted paragraph marks and remove them?

In other words, I want to remove the extra paragraph mark (highlighted) in this image...

A bad paragraph with unwanted paragraph mark highlighted

So, in human language I want to say...

  1. If a paragraph has "Paragraph style 1" applied
  2. ...and the paragraph begins with one or more digits
  3. ......and those digits have "Bold character style" applied
  4. .........and then there is a string of characters which could include footnote markers with "Footnote reference character style" applied but should not include any digits with "Bold character style" applied
  5. ............and then a paragraph mark
  6. ...............and then another string of characters which could include footnote references with "Footnote reference character style" applied but should not include any digits with "Bold character style" applied
  7. ..................and then a paragraph mark
  8. Then delete the first paragraph mark!

Now, in this particular document I am working on I could get away with not specifying the paragraph and character styles so my first thought was the following GREP expression:

(\d+ .+)(\r)(.+\r)

…which reads: find any digit(s) followed by a space and then a string of characters, then a return, then another string of characters and a return.

Then I could easily replace the three bracketed expressions with just the first and the third.

However, when I conduct a search, for some reason paragraphs with footnote markers are skipped. Also, it does not specify that the text string should not include any digits with "Bold character style" applied.

Any help will be appreciated.

3

Two criteria for your Find:

  1. Use this GREP search: \r(?!\d)

  2. And specify "Paragraph Style 1" in the Find Format field.


GREP search looks for a paragraph mark \r, not followed by a digit (a "negative look ahead") (?!\d).

  • My thought exactly. And replace with empty string, of course. Or rather, search for (\v*)\r(?!\d) and replace with $1, to make sure any trailing whitespace before the paragraph marker is maintained so you don't accidentally run words together. – Janus Bahs Jacquet Jun 3 '17 at 21:25
  • That's a good suggestion (about the trailing whitespace) but I think you mean \h instead of \v. – MG_ Jun 3 '17 at 22:09
  • Oops, yes, absolutely. Hertical, not vorizontal. (I always mix them up for some reason. I think I'm axis blind.) – Janus Bahs Jacquet Jun 3 '17 at 22:16
  • Thank you, although not exactly what I was looking for this does the trick! In the document I am dealing with it returns unwanted matches in the footnotes so I have to search for extra paragraph marks in the notes in a different way. But for the body text the suggestion is great. – Ad Astm Jun 4 '17 at 22:36
  • Great! And I have no doubt that you would need to tweak my answer to suit your situation, but hopefully it has saved you and maybe some others from doing too much manual labour. – MG_ Jun 5 '17 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.