3 Replies Latest reply on Dec 6, 2012 10:41 PM by csm_phil

    find and change GREP

    hurix@123

      Hi,

       

      I have find and change the paragraph marks using GREP using Javascript  ["~b~b+", "\\r"] // Multiple Return to Single Return

       


      But i want to add spaceAfter using GREP javascript below is my code:

       

       

      app.findGrepPreferences = NothingEnum.nothing;

      app.changeGrepPreferences = NothingEnum.nothing;

       

      app.findGrepPreferences.findWhat = "~b~b+";

       

       

      app.changeGrepPreferences.changeTo = "/r", "spaceAfter = 1.5"; (This is not updated while execute the script)

       

       

       

      Hurix

       

      Message was edited by: hurix@123

        • 1. Re: find and change GREP
          csm_phil Level 4

          Hi Hurix@123,

           

          Use the below line for remove the multile enter mark. You have to try to add the after space in your end.

           

           

          app.findGrepPreferences.findWhat = "(?<=\\r)\\r+";
          app.changeGrepPreferences.changeTo = "";
          app.activeDocument.changeGrep();
          

           

          The below line is wrong. you have to use \\r.

           

          app.changeGrepPreferences.changeTo = "/r",
          

           

           

          thx,

          csm_phil

          • 2. Re: find and change GREP
            hurix@123 Level 1

            Hi csm_phil,

             

            correct answer.

             

            and also  i have to change the format SPACEABOVE = 1.5MM

             

            please suggest me.

             

            Hurix

            • 3. Re: find and change GREP
              csm_phil Level 4

              Hi Hurix@123,

               

              First, whatever you try you end, don't expect everything in the forum. Otherwise you never learn. this is my suggestion only.

               

              And you wrote the correct answer is not a important, you just click the option is correct or help full answer.

               

               

              app.findGrepPreferences.findWhat = "\\r+(?<=\\r)";
              app.changeGrepPreferences.spaceAfter = "1.5";
              app.changeGrepPreferences.changeTo = "";
              app.activeDocument.changeGrep();
              
              
              app.findGrepPreferences = NothingEnum.nothing;
              app.changeGrepPreferences = NothingEnum.nothing;
              
              app.findGrepPreferences.findWhat = "(?<=\\r)\\r+";
              app.changeGrepPreferences.changeTo = "";
              app.activeDocument.changeGrep();
              

               

               

              thx,

              csm_phil