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 find/replace to sort list of book titles starting with "The"

Return to Member Forum

  • Author
    Posts
    • #57955
      Easybourne
      Participant

      Hello.

      I have just completed a book and CD catalogue, and I'm about to run an index for it, but I've run into a little snag. There are a great many titles that begin with “The' or “A” and, I'd prefer that they don't all end up in the index under 'T” for The or “A” for A!

      Is there any way I can use Grep to take the leading “The” and move to the end of the paragraph? eg. so that “The DaVinci Code” becomes “DaVinci Code, The”

      Am I being incredibly dumb and missing something obvious?

      Edit: The only thing I could think of was to use Grep to find beginning of paragraph followed by “The” then replace that with “, The” followed by a Tab character. Then to select text and convert to table and then transpose the first and second columns then convert back to text. Clearly this is bonkers!

    • #57967

      Try this. Search for

      ^(A|An|The) (.+)$

      and replace with

      $2, $1

      If you're about my age, you might remember a little band called “The The”. How are you gonna solve that one? ;-)

      (Ed. small improvement to get rid of an extra space)

    • #57993
      Gfx-Dzine
      Member

      ..well, if you make sure to take the first The and place it after the last one proceeded with the ', ' then you should be home clear – just make -absolutely- sure you know what's happening 'cause as soon as they become mixed up there's no way to know which one is actually the first and which one the second and so no way to fix it anymore… from there it's all downwards..

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