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 query to find first space of a given paragraph style

Return to Forums

  • Author
    Posts
    • #1202402
      JS D
      Participant

      Hello,

      I am very new to GREP queries and after a lot of trials and Google searches I am not able to accomplish what I am looking for. So here is the situation:

      The text I am working on has many numbered headings (such as “2.1 This is a level two heading” or “2.1.1 This is a level three heading”) that were written in the document (no numbered list). I want to replace the first space after the digits by an En space + Indent to here.

      Thanks in advance for your help!

      JS

      EDIT: This is what I have right now –> FIND: –> CHANGE: ~>~i –> FIND FORMAT: Heading 2

    • #14323582
      David Blatner
      Keymaster

      With GREP you could search for (\d[\d.]+?) and then replace it with $1~>~i

    • #14323581
      JS D
      Participant

      Works like a charm, thanks David! Would you mind explaining these codes, so that I can better understand GREP in the future?

    • #14323579
      David Blatner
      Keymaster

      Great question… sorry, I should have done that. Was typing too quickly. :-)

      • The stuff in the parentheses is the stuff you want to keep.
      • \d means “any digit”
      • the stuff in the brackets means “any one of these things”
      • the +? means “one or more of these”
      • means “any space”

      So the result is “find a digit, followed by one or more digts-or-dots, followed by any space… then replace it with the numbers and dots, followed by an em dash and an indent-to-here character.”

    • #14323578
      JS D
      Participant

      This is great, thanks very much!

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