6 Replies Latest reply on Aug 7, 2011 6:22 PM by John Hawkinson

    GREP problems

    rorytyson

      Hi

       

      I am fairly new to GREP and Have been trying to iron out a few bugs from the expression that I can't quite solve.

       

      Basically, I work at a newspaper and I have to format the Movies section. I have an expression that I have cobbled together which will find all of the movie names in the text and then bold them. Since every movie name, is directly after a channel name, and at the end of each movie name, it is followed by an open parenthesis I have been able to create the following expression

       

      (?<=Nine|Eleven|WTV|Go!|SBS2|SBS1|Gem|WIN|GWN7|7mate|Ten|One|7Two).+?(?=\()

       

      The problem I am having is that a two of the channel names (7mate and Eleven) both select a portion of the channel name and bold it, which is not what it is meant to do.

      Picture 4.png

      Picture 3.png

      you can see that on the Eleven the "en" at the end is bolded, and on 7mate just the "e" is bolded. All of the other channel names this doesnt happen with, and it works just fine.

       

      does anyone know what is causing this and how I can get around it? When I do a GREP F\C and just do an individual channel it works like it should, but when they are grouped it causes this poblem...

       

      any assistance would be greatly appreciated!

       

      Thanks

       

      Rory

        • 1. Re: GREP problems
          [Jongware] Most Valuable Participant

          I must say, you've had quite an impressive go at it! Unfortunately, this is a limitation in the GREP library Adobe used for InDesign. Lookbehind doesn't work for lookbehind strings of different lengths. This won't work:

           

          (?<=abcd|ef)g

           

          You have to split up the entire thing into two parts:

           

          ((?<=abcd)|(?<=ef))g

           

          If you are using this in a GREP style, it might just be easier to use multiple GREPs.

          • 2. Re: GREP problems
            rorytyson Level 1

            Thanks for your answer Jongware,

             

            I used this script which can chain together GREP searches...

             

            http://www.kahrel.plus.com/indesign/chain_queries.html

             

            So I told it to do all searches individually and ran the script.

             

            But if I do it that way, I run into another problem, where I have an entry that will actually have the same movie accross 2 channels and it causes the second part of the channel name to be bolded

             

            Picture 10.png

            I wil try splitting it up as you suggested and see how I go with that.

            Thanks again

            • 3. Re: GREP problems
              rorytyson Level 1

              I just altered the expression to

               

              ((?<=Nine)|(?<=|Eleven)|(?<=WTV)|(?<=Go!)|(?<=SBS2)|(?<=SBS1)|(?<=Gem)|(?<=WIN)|(?<=GWN7)| (?<=7mate)|(?<=Ten)|(?<=One)|(?<=7Two)).+?(?=\()

               

              but now it is just bolding all of the text from the beginning of the paragraph to the first open parenthesis...

               

              Picture 11.png

              • 4. Re: GREP problems
                John Hawkinson Level 5

                Please don't open two seperate threads where one would do.

                 

                I suspect the best solution here is not to use GREP to format this information in InDesign.

                Where is it coming from? A database of some sort?

                Either way, I suspect you would be better off formatting the information externally (perhaps by producing InDesign Tagged Text) before you import (Place) it into InDesign.

                 

                Maybe that doesn't work for you, but can you tell us more about your workflow?

                • 5. Re: GREP problems
                  rorytyson Level 1

                  Sorry John, I wasn't sure about the double post. I just thought I might have been a bit too much of a problem to tackle in one post. But in future I will keep it to one.

                   

                  With the text, I get emailed a Rich Text Format file (I dont know how it is created) but for the moment I have to assume that I can't get it to come in from the suplier with tags (I will look into it during the week however).

                   

                  Once I get the text, I place it into Indesign and then I format all of the movie names manually with the eyedropper tool. To change all of the stars and fractions, I have a system of find and changes to capture all instances. I use the ^c function in the change field (In just the regular "Text" find and change) which will replace what-ever I search for with the last thing I coppied to the clipboard.

                   

                  I am also restricted to using CS3, so I can't use GREP styles.

                   

                  Thanks

                   

                  Rory

                  • 6. Re: GREP problems
                    John Hawkinson Level 5
                    With the text, I get emailed a Rich Text Format file (I dont know how it is created) but for the moment I have to assume that I can't get it to come in from the suplier with tags (I will look into it during the week however)

                    Yeah, you should check. Also, have you double-checked to make sure the RTF file doesn't already have styling applied? You should look at it with a text editor, too.

                     

                    Reading this thread, I've lost track of whether you have an open probem or not...

                     

                    I will say, if I were doing this, I would probably try to do the formatting based on the position in the text (i.e. "first word after the first comma is bold," and "first through rd word after the first comma is bold if the 2nd word is an &"), but that might not be the best plan. Still, it's how I would start.