3 Replies Latest reply on Feb 4, 2010 11:25 PM by Shonkyin

    How to get substring from Indesign grep search

    gopaljay78 Level 1



      Can anybody tell how to extract substring from grep search.


      For example, here is my JS code:


          app.findGrepPreferences = null;
          app.findGrepPreferences.findWhat = "\\{\\{(artref|boxref|tableref) (.+)( ?)(.+)?\\}\\}";

          found = app.activeDocument.findGrep ();


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

                here I want to save the string   "$2" in to some variable.



      From the above script, I want to  save second pattern match ($2 value) to  another  variable.