How to find sentences that end in periods with no space after them

Home Forums General InDesign Topics How to find sentences that end in periods with no space after them

Tagged: ,

This topic contains 7 replies, has 4 voices, and was last updated by  Masood Ahmad 6 months, 1 week ago.

  • Author
    Posts
  • #100092

    Sheri G
    Member

    Working on a tough manuscript that has dozens and dozens of instances where one sentence runs into the next, without a space following the period. How do you search for that? Is there a way to search for “period, followed by no space?” If so, how would you write that?

    Thanks!

  • #100093

    Graham Park
    Member

    In the FIND/REPLACE dialogue box choose the GREP tab and use the below.
    This will find non space character (it will find letters, numbers and punctuation) followed by a period follow by a capital letter and will add a space between them.
    If you have two fullstops in a row or ., it will find them as well
    Second one will find a lowercase character followed by a period followed by a Capital letter
    Choose which one suits you best.

    Find
    (\S\.)(\u)
    or
    (\l\.)(\u)
    Replace
    $1\x{0020}$2

    \x{0020} = This is just a visible space character, you can just type a space in between the found items,

  • #100103

    Sheri G
    Member

    Thanks for this! It will help parse some of this. However, since this is a novel, many of these run-on sentences have quote issues, such as:

    I wondered what he was doing here.”Hey, Michael—what’s up?” I asked.
    Where did the time go?”I have to work tomorrow, so we need to cut this short.”
    “Let’s get together again soon.”I knew I’d never see her again.

    So, it can be a period, followed by an opening quote. Or a question mark, followed by text or an opening quote. Or, it can be an end-quote, followed by a capital letter.

    This is really a mess. I do appreciate anything that can help. Thanks!

  • #100104

    Graham Park
    Member

    I thin you will need two operations. First one will find the period followed by a double quote and the second the period or ! or ? and add the space.

    Find
    (\.”)(\S)
    Replace
    $1\x{0020}$2

    Then
    (\S[\.|?|!])(\S)
    Replace
    $1\x{0020}$2

  • #100106

    Graham Park
    Member

    You will probably also need to do a Find space ” and replace with ” to get rid of the extra space that has been added

  • #100139

    Aaron Troia
    Member

    Been playing around with this, it might work for you, and should only be one step

    Find: (\.|(?:\.|\?)~}|(?:\.|\?)~{)(\w)
    Replace $1 $2

    That will find just periods, periods with opening and closing parentheses, and questions marks followed by opening and closing parentheses.

    Aaron

  • #100105

    Sheri G
    Member

    Just a quick update on the first GREP statement. It worked like a charm, but it also picked up all the URL addresses listed in the book (written as http://www.AuthorName.com, etc.). I ran it as a “Find Next” rather than automatic, so I was able to skip those instances where the fix wasn’t needed. Even still, I ran through 321 fixes in about 15 minutes. For which I am very, very grateful as I am completely confident that all of these errors have been fixed. Whew!

    The second GREP query picked up 154 errors. Again, I ran it manually to ensure that it ran properly, and this took less than 10 minutes. I have saved both of these in my GREP queries for future use.

    As for the last one, it picks up all instances, including the last word of every single paragraph (because there is naturally no space after the last period of a paragraph ;o). So, this one is not going to be much of a time saver. Is there a way to exclude hard returns in the GREP query? Because if there is, then that will focus the query on just the problem spots.

    I really appreciate your help with this.

    Thanks!

  • #100780

    Masood Ahmad
    Member

    Sheri, I would recommend to post some sample text here, so that the members can write a working code for you.

You must be logged in to reply to this topic.