6 Replies Latest reply on Sep 27, 2013 2:42 AM by Peter Spier

    Tricky "Find/Change" Question!

    jessle79 Level 1

      Is it possible to find a certain amount of numbers in a story with a tab at the end of it example: 3450(tab) and change the tab to another character without changing the numbers?

       

      I need them all to look like this: 3450(comma)

       

      Howevever, the numbers change throughout the document and I dont want to change them.

       

      This would save me hours of work!

       

      Thanks

       

      *Note: I am unable to do a find and change just from Tabs to Comma's as they are used elsewhere in the document, and sometimes after numbers.

      However! There is nowhere in the story that uses 4 joined numbers in a row with a tab, which is why I need to only change the tabs to comma's after 4 numbers in a row.

      Hope that makes sense!

        • 1. Re: Tricky "Find/Change" Question!
          Michael Witherell Adobe Community Professional

          Do a GREP Find/Change:

           

          Find What:

          (?<=\d{4})\t

          The above means if there is a tab character with 4 digits on the left of it; then that is the tab you want.

           

          Change to:

          , (you type a comma and a spacebar space)

           

          Hit change all, and POW! All done.

           

          Mike Witherell in Maryland

          • 2. Re: Tricky "Find/Change" Question!
            Peter Spier Most Valuable Participant (Moderator)

            Actually that may not be the exact GREP you want, as it will find any 4 digits followed by a tab, inlcuding the last four in a longer number, or 4 digits at the end of a product name that has letters in it too.

             

            If you want to find only an isolated string of 4 digits you need to add a boundary of some sort.

            • 3. Re: Tricky "Find/Change" Question!
              Michael Witherell Adobe Community Professional

              I am having trouble interpreting the OP's last paragraph. It seems ambiguous. But assuming you are right, could the positive lookbehind be given a spacebar space?

               

              Find What:

              (?<=\s\d{4})\t

               

              That might work. And a cautious person might not like to click Change All!


              • 4. Re: Tricky "Find/Change" Question!
                jessle79 Level 1

                GUESS WHAT?

                 

                You just saved me about a BILLION hours of formatting!!!

                 

                Thank you so much, the first method  worked perfectly (I haven't gone through and checked every single one yet but the first few pages are perfect!)

                 

                Your my hero!!! Thank you soooo much!

                • 5. Re: Tricky "Find/Change" Question!
                  Michael Witherell Adobe Community Professional

                  You're welcome, jessle79. Thanks for the General Regular Expression of 'Preciation!

                  • 6. Re: Tricky "Find/Change" Question!
                    Peter Spier Most Valuable Participant (Moderator)

                    Michael Witherell wrote:

                     

                    I am having trouble interpreting the OP's last paragraph. It seems ambiguous. But assuming you are right, could the positive lookbehind be given a spacebar space?

                     

                    Find What:

                    (?<=\s\d{4})\t

                     

                    That might work. And a cautious person might not like to click Change All!


                    I would probably have used the same GREP you posted, just wanted to be sure that the OP understood it wouldn't be restrictive if that was a problem.

                     

                    (?<=\s\d{4})\t is valid, but \s matches a lot of different things and may be too general, and  the expression would fail to match four digits at the very start of a story as they wouldn't have whitespace in front of them. I'd use (?<=\b\d{4})\t or (?<=\<\d{4})\t instead to find any discreet group of 4 digits followed by a tab.

                     

                    The \b and \< are word booundaries, \b marking either end, \< marks the start, and either would work here.