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 to join split up words – help please!

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #91409
      Ken Jones
      Member

      Hi GREP fans

      I’m trying to stick back together some text which is spilt apart with spurious extra spaces.

      e.g. the line “I race ’rou n d t h e s e barrels in clov e r l e a f loops.” should read “I race ’round these barrels in cloverleaf loops.”

      I have figured that after running a double space to single space a few time the rule I want is for any word with a length of exactly one character (which is not an ‘I’ or an ‘A’ or ‘i’ or ‘a’) should have the space after it removed and so join it with the characters in front. But not sure how that looks in GREP…

      Any ideas of how to do this greatly appreciated :)

    • #91411
      David Blatner
      Keymaster

      Hi Ken,
      I’m not sure that rule really works properly. But this would the expression for that particular rule, I think:
      Find: ([^IAia])
      Replace: $1

      The caret ^ means “not any of these in this list”

      But in your example, it would remove the space after “round”, “barrels”, and others.

    • #91414

      There i snot away of knowing if the spaces are genuine or spurious. Really, you want the GREP to say “remove spaces until you find something not in the dictionary and then back up a bit”. But even then, you might end up splitting words that were intended to go together.
      ashtray or ash tray? super scripts or superscripts?
      Horrible – good luck, Chris.

    • #91417
      Ken Jones
      Member

      @David – Thanks for the help! I did need to add a space at the start too (to get single character words only) so ([^IAia]) is working for me.


      @Chris
      – ‘There i snot away’ very good! :) I agree with you not possible to know which are the legitimate spaces at the end of split words but luckily this is only happening sporadically though the text and in these cases this GREP gets me 90% there and the human eye will do final checks.

      Thanks both, top geekery.

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