2 Replies Latest reply: Apr 13, 2012 3:44 PM by Klindse704 RSS

    Adding GREP search to FindChangeByList script in CS4


      I'm trying to remove numbers from a baseball box score pulled from the Internet.

      The file has 10 numbers across separated by tabs and I only need six of the numbers not all 10


      St. Lucie Mets

      Player,Pos         AB     R     H     2B     3B     HR     RBI     BB     SO     AVG

      Daniel Muno, 2B    4     1     1     0     0     1     1     0     2     .259

      Robbie Shields, DH     4     0     2     1     0     0     0     0     1     .471


      This GREP search works in FindChange in InCopy/InDesign (using CS4)

      (\t\d) (\t\d) (\t\d) (\t\d) (\t\d) (\t\d) (\t\d) (\t\d) (\t\d)


      This works in the Change field

      $1 $2 $3 $7 $8 $9



      However, when I try to add this to a FindChangeByList script, it generates an error. So my syntax, logic or both is flawed.

      What should I do to fix it?


      grep    {findWhat:"(\t\d) (\t\d) (\t\d) (\t\d) (\t\d) (\t\d) (\t\d) (\t\d) (\t\d)"}    {changeTo:"$1 $2 $3 $7 $8 $9"}    {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double spaces and replace with single spaces.


      Thank you,


        • 1. Re: Adding GREP search to FindChangeByList script in CS4
          [Jongware] MVP

          Try again with all your single backslashes changed to double backslashes.


          .. I just checked the sample file; apparently, the only commands in there with backslashes are the ones that happen to not require them double. A Bad Example.

          • 2. Re: Adding GREP search to FindChangeByList script in CS4
            Klindse704 Community Member

            Hi Jongware,

            Thank you for the reply.

            I tried the double slashes and get an Error 25. So something I'm doing in the Search/Replace portion isn't working.


            However, I did have success with changing a style by using a GREP search. The line below works with the double slashes, just not the Find/Change lines:


            grep{findWhat:"\\t\\d\\t\\d\\t\\d\\t\\d\\t\\d\\t\\d\\t\\d\\t\\d\\t\\d"}{appliedParagraphStyle:"Z BB Box Exp Batting 07T"}{includeFootnotes:true, wholeWord:false, caseSensitive:false}

            //Changes style