Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Find and change hyperlinks using GREP query

$
0
0

Hi All,

 

I am trying to find and replace part of a hyperlink. Below is the code I tried (found and modified. thanks to whoever written this). It is working fine. However, I need to find and change only the last part of the URL (4AA3-9539ENW) since it is changing document to document.

 

The only change in the URL is 4AA3-9539ENW to 4AA3-9539ENN (just to change ENW to ENN). How to find this using GREP?

 

I tried "http:\/\/deploy.ztelligence.com\/start\/index\.jsp\?PIN=168M59L2W4H8 Z\&filename=(\d+\u+\d+-\d+\u+)(W)" with "$1N".

 

It was working fine in find and change window in Indesign. And I am not too sure how to bring this GREP query in to the following set of code. There are 4 instances of these kind of URL need to be changed.

 

Please help me on this. Thanks in advance.

 

 

   var RateItgrepForFind = "http://deploy.ztelligence.com/start/index\.jsp\?PIN=168M59L2W4H8Z&filename=4AA3-9539ENW";   var RateItgrepForReplace = "http://deploy.ztelligence.com/start/index\.jsp\?PIN=168M59L2W4H8Z&filename=4AA3-9539ENN";           var dests = app.documents[0].hyperlinkURLDestinations.everyItem().getElements();          for(var i=0;i<dests.length;i++){                    dests[i].destinationURL = dests[i].destinationURL.replace(RateItgrepForFind,RateItgrepForReplace);          }

 

 

Regards,

Muthuraj. D


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>