Copy link to clipboard
Copied
Hello, everyone!
We have a lengthy service proposal document that we re-use with different clients, with slight tweaks to customize it to each recipient. We use the client company's name frequently in the text, so I have made it a text variable, and now I don't need to worry about somehow missing an instance of an old name when we update the doc. However, we have a few cases where the client name comes at the end of a sentence. Which was fine... until we worked with a client with "Inc." at the end of their name.
Now, if I change my text variable from "Acme Anvils" to "Acme Inc.", I'll have double punctuation in sentences like "Service can be cancelled with written notice from Acme Inc.." (And no, I'm not in a position where I can just impose a re-write on the contract to avoid cases like this.)
The best workaround I can think of for this is to use 2 text variables in my document - one regular "Client Name", and one "Client Name No Period", and insert the second wherever the name happens to fall at the end of a sentence. (In the case of Acme Anvils, both variables would hold the same string (Acme Anvils). But in the case of Acme Inc., "Client Name" would hold (Acme Inc.) and "Client Name No Period" would hold (Acme Inc).) I would need to change both variables with each version of the document, but 2 changes are still much better than 30!
I have 2 questions.
1. Are text variables even the best way to accomplish this?
2. If they are, is this the best solution? Or am I missing something really obvious?
Thanks, everyone! This isn't an urgent problem - just something that's vexing me a bit and I thought I'd see if there was a better way.
The "Modification Date" Grep code is ~o!
Use [[:punct:]] posix is a very bad way to play -- I let you take a look at its definition! … So you'll need to define what you could have behind the variable!
If several para styles, you'll need to map the Grep styles in them too!
If you need to make text bigger, you'll have a problem!
So, maybe this trick seems to be cool, it is not truly! …
It's really simpler to play with 2 variable definitions!
Copy link to clipboard
Copied
No worries. Assuming that the name is the ONLY text variable, then you could use the following solution if you type the fullstop into the variable:

The first part of the GREP style will find the custom text and a piece of punctuation and apply the hide style. The second GREP will find the custom text and apply the show style. The lower the GREP style appears on the list, the more it will override the styles before it.
In theory, the GREP should simply be one line applying hide with (?<=~u)[[:punct:]] but it doesn't work and I'm not sure why.
Copy link to clipboard
Copied
Since I'm using Date Modified as well, it's not the only text variable. I am guessing that means this solution won't work for my doc, but it's very clever! Thanks for the idea!
Copy link to clipboard
Copied
I should have been clearer in my post. If the name was the only CUSTOM text variable, not text variable generally.
In GREP (find options or GREP styles) custom text variables can be found using characters ~u
If using the Modified date, this text variable can be found using different characters ~o
Others can be found by diving into the options within the find/change dialog as pictured:

Copy link to clipboard
Copied
The "Modification Date" Grep code is ~o!
Use [[:punct:]] posix is a very bad way to play -- I let you take a look at its definition! … So you'll need to define what you could have behind the variable!
If several para styles, you'll need to map the Grep styles in them too!
If you need to make text bigger, you'll have a problem!
So, maybe this trick seems to be cool, it is not truly! …
It's really simpler to play with 2 variable definitions!
Copy link to clipboard
Copied
I would proceed as you with 2 variable definitions and, of course, the same definition if no dot!
Simplistically simple and clever!
Copy link to clipboard
Copied
Thanks to both folks who are offering their expertise - it's very helpful in planning out how this document may evolve, and certainly very helpful with my limited GREP skills. I'm going to go with two variables for the reasons stated in the discussion (type size, different paragraph styles, etc.) but I really appreciate both answers, as I can see times when using the GREP code given will be really helpful as well. Thanks again!
Copy link to clipboard
Copied
Btw: In the 2 approaches, you'll need to modify the "client" variable(s)! Once in Colin's way, 2 times in your present way (and mine).
It just took me 7 seconds to copy the new definition in the first variable form, open the second variable window, "2-tab" to jump in the right form, paste it in it adding or not a dot and play "Enter" two times!
Sure It took me truly more time to convince you you was right! ![]()
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more