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 find a match and delete it

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #66019
      theobear
      Member

      I have a very long document and in the headers I list list the paragraph numbers on the particular page using intools Powerheaders like so:

      N. 123-130

      sometimes there is only one numbered paragraph and (perhaps because I really don’t know how to use powerheaders)it will do this:

      N. 123-123

      because I am in a hurry and don’t want to figure out how to use powerheaders properly (I know, I know) I thought If I could do a find and replace across documents and find something like:

      (the number)-(the same number) and replace with (The number)

      so then 123-123 would be 123
      but it would leave 123-130 alone

      is this possible with grep?

      THANKS

    • #66041
      Anonymous
      Inactive

      That sounds like more of a scripting thing to me -I don think you have that option in GREP. But there are cleverer people than me on the boards, maybe someone will have a great idea.

    • #66114
      theobear
      Member

      anyone else?

    • #66154
      Alvin Leu
      Member

      here it is .. (\d? this is for the number of digits.. for now it works for 1-3 digits)

      find with ..
      (\d\d?\d?)-\1

      replace with
      $1

      • #66207
        theobear
        Member

        Wow, that’s great. If you get a minute could you explain what is going on. THANKS so much.

    • #66208
      theobear
      Member

      oh, and also this finds

      11-12

      and matches the 1-1 (the second 1 of the 11 and the first 1 of the 12) any ideas on how to fix this?

    • #66221
      Alvin Leu
      Member

      You can to detect if its a starting word by adding a

      (\d\d?\d?)-\1

      not sure if it solves your problem

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