You must be logged in to post Login

Search Forums:


 






GREP styles question

UserPost

4:52 am
September 6, 2011


fruitlesseffort

UK

Community Member

posts 4

Hello

I am trying to incorporate a GREP style into a paragraph style (as I haven't done it before). I want every instance of a company name, eg. XYZ, to be capitalised. I have managed to get it working to some extent. However, it also applies the style to the web address eg. http://www.XYC.com. Is there a simple way of making it not do that?

Thanks in advance!

6:22 am
September 6, 2011


Jongware

Member

posts 763

There is a not-that-simple way :)

The name in the web address contains periods to its left and right; adding "word breaks" to your name is enough to make the single word version distinctively different:

\bXYZ\b

That said, I think it's bad practice to use GREP styles to capitalize phrases that are supposed to be capitals to begin with. It's generally much 'cleaner' to bite the bullet and use Find/Change to have actual capitals in your text. Imagine, for example, what happens if you export this text out of InDesign to re-use in a web page.

6:29 am
September 6, 2011


Jongware

Member

posts 763

Crap, it doesn't work! And it's your own fault at that. Why is your company name "XYZ" in its stand-alone version but "XYC" in the web address?


Okay, on to the decidedly-not-simple-anymore solution. The web address contains periods to its left & right, and while there may be a period to the right of the actual name, there never should be one at its left.

Try this:

(?<!\.|\w)XYZ\b


Here is, by the way, another reason not to use this trick to capitalize your company name. If the company name is a common word in all caps ("WORD", for example), all occurrences of that word in lowercase will be automatically picked up as the company name.

8:41 am
September 6, 2011


fruitlesseffort

UK

Community Member

posts 4

Thanks for those suggestions, I am really just trying things out and figured it would be a good place to start as it was something I had to do. The name isn't common or an actual real word and its not XYZ (or C for that matter!) so the random capitalisation shouldn't be a problem. Although I will probably just do a find/change, as you say, for the actual job.

Thanks again!

10:41 am
September 6, 2011


Ladydreadlock

New Member

posts 2