Article View: adobe.scripting.indesign
Article #9919Re: Help needed with regular expression.
From: Jerker_Dahlblom
Date: Thu, 13 Jul 2006 08:06
Date: Thu, 13 Jul 2006 08:06
14 lines
1466 bytes
1466 bytes
Got it to work. I got going after looking at Dave Saunders Regex Tester script. <http://jsid.blogspot.com/2005/12/how-to-begin-scripting-part-1.html>
Here is the script:
//var debugString = "REPORT:\n";
var expression = /\t\d+\.\d{2,}/ig;
for(z=0;z<app.activeDocument.stories.length;z++){ story = app.activeDocument.stories[z]; for(var i = story.paragraphs.length-1;i>=0;i--){
currentParagraph = story.paragraphs[i];
regularExpression = new RegExp(expression);
var regExTest = regularExpression.exec(currentParagraph.contents);
if(regExTest != null){
debugString = debugString + " " + regExTest[0];
for (var j=0;j<regExTest.length;j++) { app.activeDocument.search(regExTest[j], false, false,'\t'); //debugString = debugString + "\n$" + String(j) + " = " + regExTest[j]; } } } } //alert(debugString);
Technical Details
Message-ID:
<3bc0dfb6.4@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!news.motzarella.org!news.ecp.fr!news.stben.net!webcrossingReferences:
<3bc0dfb6.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,8bed2397d36f00d4 X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Jerker_Dahlblom@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Re: Help needed with regular expression. Message-ID: <3bc0dfb6.4@webcrossing.la2eafNXanI> Date: Thu, 13 Jul 2006 01:06:35 -0700 References: <3bc0dfb6.-1@webcrossing.la2eafNXanI> Lines: 26 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!news.motzarella.org!news.ecp.fr!news.stben.net!webcrossing