10 Replies Latest reply on Aug 29, 2013 6:04 AM by MakeFast

    Find more than 9 digits

    MakeFast

      HI Forum.

       

      I want to find digits more than 9 characters and retain...

       

      eg. 12345678910

       

      app.findGrepPreferences.findWhat = (\\d)+(\\d)+(\\d)+(\\d)+(\\d)+(\\d)+(\\d)+(\\d)+(\\d)+(\\d)

      app.changeGrepPreference.changeTo = $1$2$3$4$5$6$7$8$9 //then how to include group for 10th character...

       

       

      thanks & regards...

        • 1. Re: Find more than 9 digits
          Vamitul Level 4

          guh.. maby you want to be a bit more clear about what tou are trying to do, because right now doesn't make much sense.

          to find more than 9 digits:

           

          find: (\\d{9,})

          • 2. Re: Find more than 9 digits
            MakeFast Level 1

            HI sir,

             

            actually im find digits more than 9 and retaining the same 9 digits with some space given inbetween.

             

            so uptill 9 digits, i can retain with $9... so what is the option to retain 10th digits, 11th , 12th digits..

             

            eg. if 123456789123  //here 12 digits are there

             

            and i want to change to

             

            12 34 567 891 23

             

            // for this i m using

            app.changeGrepPreference.changeTo = $1$2//s$3$4//s$5$6$7//s$8$9

             

            for nine digits to retain

             

            after that if i give $10,    it'sagain pasting the first digits...

             

            Many thanks

            • 3. Re: Find more than 9 digits
              Vamitul Level 4

              oh now i see. as far as i know you can't use more than 9 groups in grep.

              but you are going at it the wrong way. you are not looking for 12 digits, but looking for 2 digits, followed by another 2, followed by 3 more.. you see the pattern here, i guess. so your searcg should be:

              (\\d{2})(\\d{2})(\\d{3})(\\d{3})(\\d{2})

              and replace with:

              $1 $2 $3 $4 $5

               

              notes: \\d{2} can also be written as \\d\\d, and \\d{3} like \\d\\d\\d

                         \s means any kind oh whitespace, so using it in the replace box is.. wierd. use plain space, or ~S if you need a nonbreaking space.

              • 4. Re: Find more than 9 digits
                Jump_Over Level 5

                Hi,

                 

                If your 12 (or even more) digits are mixed with spaces irregularly you should split it in 2 steps.

                First: clean it up using find: (\d)\s*(\d)     change: $1$2;

                Second: yours digits are ready for Vlad's solution.

                 

                Jarek

                • 5. Re: Find more than 9 digits
                  MakeFast Level 1

                  Thanks you sir(s).

                   

                  First used \s$ to remove space before paragraph marks after digits.....

                  then....

                  Using Jarek idea 1st: find: (\d)\s*(\d)

                   

                  (replaced * with +)

                  (\d)\s+(\d) ( to remove multiple spaced between any number of digits..... more than 10 digits 12 or 25 etc.,.

                   

                  but what happens after the spaces are removed...

                  all the digits combine as single line, instead they stand on their own line....

                   

                   

                  eg.. 1 23 232 50-459459904       3434   12                   line 1

                  1 23 23     2 50-459             4599      04  

                  3434   12     line 2

                   

                  now  converted to single line....

                  12323250-45945990434341212323250-459459904343412  LIKE THIS

                   

                  12323250-459459904343412 line one

                  12323250-459459904343412 line two

                  should be like above....

                   

                  Many thanks.....

                   

                  sorry if my request is confusing...... you...

                  • 6. Re: Find more than 9 digits
                    Jump_Over Level 5

                    Hi,

                     

                    find: (\\d)?[\\t+\\x{20}+](\\d)?

                    change: $1$2

                     

                    \\t      is for tabs

                    \\x{20}      is for regular spaces (spacebar key)

                    include more kinds of space into [ ] if needed

                     

                    Jarek

                    • 7. Re: Find more than 9 digits
                      MakeFast Level 1

                      But Jarek G..

                       

                      Using $1$2 for retaining....gives the result...

                       

                      some of the digits missing.....

                       

                      also it searches and removes the spaces inside the paragraphs......

                       

                      So, would it be great to find only the multiple digits and its multiple spaces accompanied....

                       

                      then keep all the digits without spaces......

                       

                      Manythanks.... Jarek...

                      • 8. Re: Find more than 9 digits
                        Jump_Over Level 5

                        Hi,

                        yeah, "?" means 0 or 1..., so this one:

                         

                        (\\d)[\\t+\\x{20}+]+(\\d)

                         

                        Jarek

                        • 9. Re: Find more than 9 digits
                          elansezhianr72877736 Level 1

                           

                          Check This:

                           

                          example:

                          1234567891012234567891012

                          1 23 456 7 89 101 2234567891012

                           

                          (\d{1})(\d{2})(\d{3})

                           

                          $1~S$2~S$3~S

                          • 10. Re: Find more than 9 digits
                            MakeFast Level 1

                            Thank you Jarek,

                             

                            for all the reply and support....