Toad World® Forums

Asterisk in Replace With


#1

When there is an asterisk in the Replace With field, the asterisk along with the preceding character is removed.

Find: BID, Replace With: BID*CNT

Result:
BICNT


#2

Can you tell me what version of Toad for DB2 you are running and more information about the context in which you are seeing this issue. Screen shots and a support bundle would also be helpful.

I tried the following scenario in both Toad for DB2 V4.6 and V4.7. I opened a SQL Editor window and executed 'Find: BID, Replace With: BIDCNT’ on the statement ‘Select * from BID;’. In both versions the replace performed as you would expect and the statement was transformed to 'Select * from BIDCNT;


#3

Can you try it with Regular Expressions turned on?


#4

I can reproduce what you report if I check ‘Use Regular Expressions’ however I can get the replace to work the way you want if I specify replace with BID*CNT (escaping the regex special character).


#5

The Replacement text should not need to be escaped. The RegEx should only apply to the Find text. This looks like a defect to me as I tested this with 7 other editors and they all do not require escaping the replacement text.


#6

I consulted with the product architecture team and the response was that the syntax editor Find/Replace control is documented as supporting regular expressions in the replacement string as well as the search string when the ‘Use Regular expressions’ option is checked.


#7

The grouping substitutions ($1, $&, $$) is documented and useful. Can you show me examples of how other metacharacters like the asterisk can be used?