12 Replies Latest reply on Aug 21, 2013 11:35 AM by tusharde

    GREP to find up to 3 words in a row followed by colon

    tusharde

      I usually have to do the repettive task of indenting dialog in a script. See image. I am trying to write a script that involves a GREP find/replace that will find the following:

       

      From the beginning of a paragraph, find one to three words that are followed by a colon.


      This is a GREP expresssion i have writtern to so far. It worked fine until i realized that it is greedy in it's search. As you can see in the case of the line with  time in there. It avoids the first colon and greedily grabs the next one from the time stamp.

      What is the solve for this? Is there a better regex expression? Any help would be great.

       

      The GREP i have so far.

      ^((?:\w\S*)(?:\s)?(?:\w\S*)?(?:\s)?(?:\w\S*)?):((\t+)?(\s+)?)?
      

       

       

      Screen Shot 2013-08-19 at 7.49.55 AM.png