I'm not so hot with GREP, but I love using it for formating text when I can.
I'd like to apply small caps to "st, nd, rd and th" when used in 1st, 2nd, 3rd, 4th, etc., but I'm having trouble limiting where it is applied. I've tried some positive look behind and look ahead rules, but I'm still failing.
I'm using the GREP below:
Using it for addressing like below:
151 West 34th Street
Long Island City, NY 11101
I don't want the "st" in West or the "nd" in Island small affected, but haven't figured out how to control that. Any suggestions greatly appreciated.
Thanks for the quick and effective reply. It definitely seems to work. I have to apply this to several hundred addresses, so hopefully I won't find any exceptions. However, first 30 examples look promising.
I really appreciate the help. I never thought to use a word boundary like that. I'll add that to my arsenal for next time.
Yeah the word boundary was to add a little more robustness against matching, say, a wacky start-up company name "12think". Adding the parenthesis to group options separated by bar (|) is almost always essential. In your original grep, I think the lookahead at the end would only apply to "st".