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 (searching/replacing initials)

Return to Member Forum

  • Author
    Posts
    • #62908
      Montaillou
      Member

      Hi,

      I'm using Indesign CS3, and trying to accomplish what I suspect is a very simple task for anyone who knows anything about GREP syntax. I want to search for strings of caps in initials to names (generally of authors) – A.B. Jones, W.E.B DuBois, for example. I've worked out how to search for those strings (u.u), but can't work out how to make the substitution I want to – namely, to add a sixth-space in between each period and the following capital letter. (Incidentally, I also want to make the same substitution where a full space, rather than no space, has actually been inserted – A. B. Jones etc.).

      When I try to make the substitution, it just inserts the actual GREP expression itself – i.e. “u.~%u”, rather than just inserting a sixth-space.

      So, I'm clearly making some very elementary mistake – I'd be grateful for any guidance! While I'm here, I'd also be interested if anyone can point me in the direction of a reasonably comprehensive online guide to GREP expressions that is nonetheless aimed at beginners. I've done a bit of googling, but not found anything that quite fits that description.

      Many thanks in advance…

      Montaillou

    • #62909
      Montaillou
      Member

      I just noticed that somehow the website has messed with the GREP expressions so that what I've written doesn't make sense.

      So, for example, where it says “(u.u),” I actually inserted backslashes before both u's and the period. I'm not a complete idiot!

    • #62910
      Anonymous
      Inactive

      Montaillou,

      I made this mistake often when starting with GREP. The key is that the search for field uses different things than the replace field.

      If you want to replace the first uppercase with itself, surround the first backslash-u in parentheses. Same with the second backslash-u.

      Then, in the Change to: field, use: $1.~%$2

      This replaces the first found variable (in the parentheses) with $1 and the second found variable with $2, putting a period and sixth space between them.

      Jake

    • #62911
      Montaillou
      Member

      Jake – thanks so much for the response. Exactly what I needed!

      I'm still a bit mystified, though, by why “$1” etc. does what it does. I don't suppose you happen to know of a good online (or, for that matter, printed) source of information on GREP expressions and how they work in InDesign?

      Thanks again!

    • #62919
      Anonymous
      Inactive

      This should get you started.

      https://www.indesignusergroup.c…..murphy.pdf

      also, just so you know you can make the backslashes appear by putting two in a row u

    • #62924
      Montaillou
      Member

      Thanks – that's really helpful. Managed to find a few other resources online since then as well, but not this one.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Forum Ads