0 Replies Latest reply on Mar 27, 2013 8:06 AM by kmc27

    GREP vs Text Find/Change Question

    kmc27 Level 1

      Hello

       

      I'm getting different results using InDesign CS4's Find/Change tool. My document behaves one way when a Text find/change is pefromed, and differently with a GREP find/change. I was hoping someone might be able to help me figure out why there is a difference.

       

      Here is my workflow

       

      1. Blank InDesign document is loaded with XML (proprietary) from an authoring program

      2. Copy blocks on a page contain either a place holder number of "0" or a fulfilled six digit number

      3. Use InDesign Find/Change to add "ID" in front of the "0" or six digit number

      4. When the unknown six digit number are determined, a new XML file is created and loaded into the InDesign document

      5. If I had used a Tect based InDesign Find/Change in step three, then when step four is performed the number populates and "ID" remains

      6. If I use a GREP based InDesign Find/Change in step three, then when step four is performed, the number populates but also removes "ID" I want "ID" to remain.

       

      I'm want to se the GREP Find/Change because it can find both a zero and a six digit number

       

      Here are my two find/change search and replace criteria

       

      TEXT Find/Change

      Find What: ^p0

      Change To: ID

       

      When use this Find/Change and then perform step #4 above, the word ID remains and the six digit number follows it - this is what I want to happen.

       

       

      GREP Find/Change

      Find What: (\d{6}|0)\r*\Z

      Change To: ID $1


      When I use this find/change and then perform step #4 above, the six digit number loads into the InDesign page, but "ID" is removed.  I want the word ID to remain, and the 0 to be replaced with the six digit number.

       

      I went with the GREP find because I have to accont for both the place holder zero and those copy blccks for which the six digit number was already known. Thanks a couple of users on this forum, Laubender and Jongware, the GREP code is finding the correct numbers. But I don't see why the subsquent XML updates of the document after a GREP find/change has been performed result in the "ID" to be deleted. Any ideas on how to get the "ID" to remain after updated XML is loaded ino the InDesign document would be appreciated. Thanks in advance for your time, especially if you've read this far and understand what I am describing.