You can do what you want using a
general program mode template in the plugboard. One statement would use the contains function to pull out text that indicates that the series is already there, and assign the resulting text to a variable. Another statement would "test" the variable. If it is empty then you generate the text you want. If it is not empty then you pass the title through unchanged (or whatever you want to do). The "template" function would be useful when generating the text.
Something like
Code:
program:
a=contains(field('title'), '\[', 'XX', '');
test(a,
field('title'),
template('{series:||-}{series_index}{title}'))
Of course you could nest the contains into the test instead of assigning the result to a variable.