4 Replies Latest reply on May 23, 2014 12:54 AM by Belsen01

    GREP help




      I am new to GREP and cannot figure out how to make this work:


      I scan some pages and often the same mistake occurs:


      The scanner mistakes "1" for "I". (Capital i)


      Where it shoud say "1. december" it says "I. december"

      "10. januar" becomes "I0. januar"

      "2014" becomes "20I4" - would be nice to make a GREP search here I think.


      I hope that someone can help me.



        • 1. Re: GREP help
          Obi-wan Kenobi Level 5



          As I suppose you want to do it at the beginning of your work, you need to go to the washing machine.


          About the first problem, it's easy. The following are more interesting. I treat it as:

          Search:  (?<=\d)I+|I+(?=\d)

          Replace by:  1


          Difficult to find: "I've liked II with George Clooney!" 


          ... but you can extend the research with a global grep style to find this type of occurrence.

          • 2. Re: GREP help
            Mary Posner Level 3

            Tried your example, Obi-wan, but it misses the first instance since there is no digit before "I. december".


            Anita, try this and see if it works for you:


            Find what: I((?=\.)|(?=\d))

            Change to: 1

            • 3. Re: GREP help
              Obi-wan Kenobi Level 5

              Hi Mary,


              It doesn't miss it: I don't try to treat it. I treat the 2 other cases. But I"ve seen a bug.


              This treats all:


              Search:  (?<=\d)I|I(?=\d)|(?<=I)I|I(?=I)|I(?=\.)

              Change to:  1

              But you'll need to launch it 2 times! 

              Yours forget more if you want to treat, eg:  I0I  /  20II  /  201,15  /  II.  /  III …

              I"ve not limited the research to the dates!

              • 4. Re: GREP help
                Belsen01 Level 1

                Thanks Mary and Obi Wan,


                I found that Obi Wan's search does the trick. Amazing - thanks a lot for your help.