0 Replies Latest reply on Sep 9, 2015 12:21 AM by Designer of Indesign

    I need find cross references in xml Tag element

    Designer of Indesign

      Hi friends,

       

      I need script for convert 2[ndash]3, 4[ndash]5 should be 2,3 and 4,5 with xml tag element. Please give suggestion.

       

      test.png

       

      var doc = app.activeDocument;

      app.findGrepPreferences = app.changeGrepPreferences = null;

      app.findGrepPreferences.findWhat = "(\\()(\\d+)(~=)(\\d+)(\\))";

      var found = doc.findGrep();

      for(var i=0;i<found.length;i++)

      {

                 

              var num1 = found[i].contents.toString().replace(/\d+/,"").replace(/–.+\)/,"");

              alert(num1.length);

              var num2 = found[i].contents.toString().replace(/\(.+–/,"").replace(/\)/,"");

              if(parseInt(num1) + 1 == parseInt(num2))

              {

                      app.changeGrepPreferences.changeTo = "$1$2, $4$5";

                      found[i].changeGrep();

                  }

          }