'how to maxscript rename multiply object?

I'm a newbie, I want to ask one thing how to change name prefix on multiple objects/bones for example

object_123 object_234 object_345

I just want to change the name of the prefix "object_" which will be changed to "subject_" and the result will be like this

subject_123 subject_234 subject_345

I will appreciate all incoming replies thank you



Solution 1:[1]

You can use substituteString to do the string replacement, for example to change the prefix on selected objects with matching names you could do it like this:

for obj in selection where matchPattern obj.name pattern:"object_*" do
    obj.name = substituteString obj.name "object_" "subject_"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Swordslayer