Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

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

$
0
0

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


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>