# How to insert a number in a specific position of a letter in a word

I have about 1000 variable names. Four example are:

DPI[1]
PXAC[a, c]
TRANS
PDS[c]


I like to insert 0 in a specific position in the given variable names such as:

DPI0[1]
PXAC0[a, c]
TRANS0
PDS0[c]


I searched for solutions from the already asked questions, but could not find any. Normal insertion codes in this forum do not help me because in my case the insertion should be as shown above.

Two rules should be applied:

1. insertion should always be before this [.
2. for those variable names without [...], the insertion should be at the end of the word.

Thanks.

list = {DPI[1], PXAC[a, c], TRANS, PDS[c]};

 {DPI0[1], PXAC0[a, c], TRANS0, PDS0[c]}

• It works fine for a newly created list of variables. In my specific case, the list is created out of the model equations by picking the relevant variables (by using another code that you have written a few months ago). Since my variables are associated with some model definitions, the current code does not work. I used ClearAll[ list ] to clean the variable definitions or any assignments but ClearAll[...] is not cleaning anything. Any idea? – Tugrul Temel Apr 30 at 12:36
• tried ClearAll["Global*"]? – kglr Apr 30 at 12:48