3 Replies Latest reply on Oct 8, 2013 3:01 AM by Jump_Over

    Reg. Apply thin space for Mathematical operators

    Sathya Rani M

      Hi All,

       

      Can you please anybody help me to find the mathematical operators such as +,-,*,/,<,>,<=,>=,= etc and apply thin space before and after these operators.

       

      I have tried with below code but it is affected all the cases, For Eg. if '=' present in URL and '/' or '-' found in between words, there also the thin space is applying.

       

                 var myDocument = app.activeDocument;

                  app.findGrepPreferences = NothingEnum.nothing;

                  app.changeGrepPreferences = NothingEnum.nothing;

       

                  app.findGrepPreferences.findWhat = "([-]*\\d+)([+|-|*|/|\=|\<|\>|\<\=|\>\=|\<\<|\>\>])([-]*\\d+)";

                  myDocument.findGrep();

                  app.changeGrepPreferences.changeTo = "$1~<$2~<$3";

                  myDocument.changeGrep();

                  app.changeGrepPreferences = NothingEnum.nothing;

                 

                  app.findGrepPreferences = NothingEnum.nothing;

                  app.changeGrepPreferences = NothingEnum.nothing;

       

                  app.findGrepPreferences.findWhat = "([-]*[A-Z|a-z|A-z]+)([+|-|*|/|\=|\<|\>|\<\=|\>\=|\<\<|\>\>])([-]*\\d+)";

                  myDocument.findGrep();

                  app.changeGrepPreferences.changeTo = "$1~<$2~<$3";

                  myDocument.changeGrep();

                  app.changeGrepPreferences = NothingEnum.nothing;

       

                  app.findGrepPreferences = NothingEnum.nothing;

                  app.changeGrepPreferences = NothingEnum.nothing;

       

                  app.findGrepPreferences.findWhat = "([-]*\\d+)([+|-|*|/|\=|\<|\>|\<\=|\>\=|\<\<|\>\>])([-]*[A-Z|a-z|A-z]+)";

                  myDocument.findGrep();

                  app.changeGrepPreferences.changeTo = "$1~<$2~<$3";

                  myDocument.changeGrep();

                  app.changeGrepPreferences = NothingEnum.nothing;

       

      But I need to apply thin space only for Mathematical expressions. Thank you for spending time for analysing my scenario.

       

      Regards,

      Sathya Rani M