Article View: adobe.scripting.indesign
Article #9917Re: Help needed with regular expression.
From: Peter_Kahrel
Date: Thu, 13 Jul 2006 09:31
Date: Thu, 13 Jul 2006 09:31
14 lines
1394 bytes
1394 bytes
That looks like a mighty complicated way of doing things. The version below does what you want, as far as I can see. The first line concatenates the contents of all stories into one string, joining the contents with \n just in case any last line in a story doesn't end in \n. The regular expression assumes that anything between a series of tabs and \n is a price to be deleted, you may need to tweak that.
Peter
txt = app.activeDocument.stories.everyItem().contents.join('\n')+'\n';
searchResults = txt.match(/[\t]+([^\n]+)/g)
if( searchResults != null )
{
app.findPreferences = app.changePreferences = null
for( i = 0; i <searchResults.length; i++ )
app.activeDocument.search( searchResults[i], false, true, '^t' )
}
Technical Details
Message-ID:
<3bc0dfb6.5@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!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: Peter_Kahrel@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Re: Help needed with regular expression. Message-ID: <3bc0dfb6.5@webcrossing.la2eafNXanI> Date: Thu, 13 Jul 2006 02:31:42 -0700 References: <3bc0dfb6.-1@webcrossing.la2eafNXanI> Lines: 19 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!news.ecp.fr!news.stben.net!webcrossing