Toad World® Forums

Auto replace with "_" in object name

did not find a similar discussion for this:
we have a lot of objects with "_" (underscore) embedded in name, for ex: "due_dt". Based on a value of 'dt=drop table', it expanded to "due_drop table" ,can this be bypassed? I think earlier Toad did not do so?

I know the Case Sensitive option, but I'll have to remember it when typing the names, is there an easier way?

Earlier Toad versions would probably have behaved the same way here, although I would need one of the Devs to confirm. Ideally, I think the ultimate fix here is an enhancement that allows different activation characters to be defined for different auto-replace strings.

Short of messing with the Activation Characters for better control (snap 1 below) another option is to define your shortcuts via Code Templates (snap 2 below). For example, I created a "dt" entry in the Templates library, as shown (and got rid of the "dt" entry in AutoReplace library). Whenever I want "dt" to be replaced by "drop table" I just hit Ctl- after "dt" to trigger the replacement.

Hope this gives you some more ideas to ponder.

I'd say this is a bug.

In Options -> Editor -> Behavior, there is a setting for Additional Word Chars. Underscore is the default value there. By having that set, we should not replace the dt in due_dt. I'll fix this for the next version.

Thanks. Templates is great option & can work here, but I typically use templates for more complex expressions that saved me a ton of typing.

Thanks looking forward to the fix in the next version. Any chance maybe a patch to v13?

Just to clarify my understanding about AR:

Additional Word Chars - isn't that for triggering auto replace after an expression? For ex: I type "dt" + "_" then it expands the string. Not sure if it's relevant here, as we are trying to prevent if from expanding the expression: "due_dt". Typically space will expand it which we don't want.

Sorry, we only make patches for major bugs, and even in that case, only the most recent version.

To see "Additional Word Chars" in action, try this:

  1. leave it set to an underscore.
  2. type under_score in the editor and double-click anywhere in the word. The whole word is selected.
  3. Clear out the Additional Word Chars setting.
  4. Repeat step 2. Now, the selection stops where the underscore character is.

So, with Additional Word Chars set to underscore, due_dt should never trigger autoreplace for dt (but it does, so that's a bug). We should see "due_dt" as 1 word, not 2 words separated by an underscore.

Options -> Editor -> Auto Replace -> Activation Characters are different. This refers to the characters that you can type AFTER "dt" (besides whitespace) to turn it into "drop table" So, notice parenthesis are in there. You could type "dt(" to turn into "drop table(". If you take the parenthesis out of this setting then "dt(" will remain unchanged.

ok got it thanks, i was mixing it up. Yes it was the 1st char in the set & working well for word selection, just not for auto replace.