Swapping order of words with GREP

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Swapping order of words with GREP

Tagged: , ,

Viewing 3 reply threads
  • Author
    Posts
    • #77876
      Adam Byrne
      Member

      Hey guys,

      I have 1,500 photos that need to be inserted into an InDesign document and each need to have the name’s below the photo. This part is easy as it’s just a simple data merge. Where I’m having difficulty is that I have been supplied the names incorrectly. For example I would need it to appear ‘John Smith’ but I have been supplied the text as ‘Smith John’.
      Is there any GREP command that can select the first word of each paragraph up until the space and then send it to the end of the paragraph?
      If there is it is going to save me a days work!

      Thanks in advance :)

      Cheers,
      Adam

    • #77881
      Loic Aigon
      Member

      What about this :

      F : (\w+) +(\w+)
      R : $2 $1

      ?

      Otherwise you could think of a script to rename the files accordingly prior to data merging.

      FWIW,

      Loic
      https://www.ozalto.com

    • #77883
      David Blatner
      Keymaster

      Also note that I discussed this same process in my video title on Data Merge at lynda.com

    • #77917
      Adam Byrne
      Member

      Awesome! Thanks guys. Just saved me a tonne of work.
      Really appreciate the help! :)

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>