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 eliminate extra digit at end of phone#

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #69498
      Jan Sklennik
      Member

      Client file has 2,650 paragraphs, each with a phone number that has an extra “4” at the end. After formatting and indexing we found the error. Numbers are all formatted the same: (xxx)xxx-xxxx4

      It seems like a good place for GREP, and I can get it to find the string [ -\d\d\d\d4 ] but I can’t figure out how to keep the right “found text” and delete the “4”.

      Any help would be greatly appreciated.

    • #69500

      Are you saying that the number is at the end of the paragraph and followed by a paragraph return?

      I’m not good at GREP, but what about a simple search and replace?

      Search for the 4 followed by a paragraph return and replace with the color red (Or any color not being used in the job).

      Then search for a red 4 and delete it.

      ***
      If it’s not that (i.e., a hard return following each of those 4’s, then I’m not sure.

    • #69504
      Tom Venetia
      Member

      I am not good at GREP either, but to me the simple solution is a search and replace like this one
      1. search for 4\r
      2. replace ALL with \r

    • #69505

      ^^I too, had thought of that however: I believe that if you simply replace a hard return (even though the number 4 before it) with just a hard return–you may lose the formatting on the following paragraph.

      I’ve had that happen when messing around with replacing hard returns.

    • #69507
      Jan Sklennik
      Member

      Thank you.

      Unfortunately it’s in the middle of the paragraph — which also includes an EIN number (which contains a “-xxx…”) and other digits so I have to be careful.
      So I need to select all or part of (xxx)xxx-xxxx4 and keep (xxx)xxx-xxxx
      I’m not sure how to isolate the four digits following the “-” and keep them while deleting the “4”. If I could isolate the four digits — I tried putting them in ( ) — then I could change to a found set without the 4. But that’s the part I can’t figure out.

    • #69508
      Jan Sklennik
      Member

      Oh wow. That might work. I FIND the phone number and CHANGE to the phone number plus a marker character and a return. Then eliminate the final 4. Then put the paragraph back together. I’ll let you know if that works. Thanks.

    • #69509
      Jan Sklennik
      Member

      Brilliant — thank you so much!!

      I changed to the Found Set plus a “=” and a return. Then searched for the “= return” (so i wouldn’t find all my other returns) and deleted those two characters. There may have been a more elegant way but this way worked — thanks!

      • #69514

        glad you got it straightened out. It’s amazing what you can do with search and replaces.

    • #69624

      Try this in the GREP find/change

      Find

      -(\d{4})4

      Change to

      -$1

      • #69625

        I re-read your post, and saw the ein problem.

        So…

        Find

        (\(\d{3}\)\d{3}-\d{4})4

        Change to

        $1

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