Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

GREP help finding multiple combinations in a paragraph

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #117366
      Joseph Lops
      Member

      I have the following string of text in a paragraph:

      . . . and Written Grammar defines as “words or phrases like ‘anyway,” ‘right,” ‘okay,” ‘as I say,” ‘to begin with.” We use them to connect, organise and manage what we say or write . . .

      elsewhere in the document there are combinations of 4, 5, 6, etc words

      and I want to change the open single quotes to open double quotes, but I can’t seem to figure out how to find all groups of word counts.

      (‘)(.+)(\p{punctuation})(”) will find ‘anyway,” and all text to the end of the paragraph
      (‘)(\w+)(\p{punctuation})(”) will find ‘anyway,” / ‘right,” / ‘okay,” but not ‘as I say,”

      I have tried everything I can’t think of and nothing is working for me. Of course I can write and endless string of word numbers using | but I am sure there is an easier way.

      help please.

      thanks

    • #117367
      Aaron Troia
      Participant

      Hey Joseph try this,

      (‘)([^”]+)(”)

      Using [^”]+ will tell the search to find everything up, to but not, closing double quotes and will make make the search less greedy than .+ but more greedy than \w+ but wont go past the first instance of the double quotes.

      Aaron

    • #117368
      David Blatner
      Keymaster

      What if you just searched for '\w which means a single quote followed by any word character.
      Then replace it with a ”
      See also:
      https://creativepro.com/tip-of-the-week-exchanging-apostrophes.php
      and:

      GREP to replace straight double quotation marks

    • #117369
      Joseph Lops
      Member

      works great.
      thanks!

    • #117370
      Joseph Lops
      Member

      thanks David, but there are single quotes that need to stay single.

Viewing 4 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads