3 Replies Latest reply on Oct 4, 2010 2:16 PM by Marijan Tompa [tomaxxi]

    GREP with Javascript vs. Find/Change dialog

    ckcosner

      InDesign CS4

      Find/Change dialog, GREP tab

      Find:

      (www|http\:\/\/)([\w\-\?\=\&]+[\.\/]?)+

      This expression finds hyperlinks pretty well.

       

      When I put it in a .jsx file and fire it from the Scripts palette, it doesn't work.

      The following works, but obviously doesn't match as many hyperlinks:

      http\:\/\/([\w\-\]+[\.\/]?)+

      as in

      app.findGrepPreferences.findWhat = 'http\:\/\/([\w\-\]+[\.\/]?)+';

      I've tried adding ?, \?, and \\? but it bombs out -- no matches.

      Same thing with the initial either/or between www and http as the start of the pattern.

       

      I wonder if a javascript grep guru could give me a hint as to how to translate this?

       

      Thank you.