Renaming families in bulk, issues with "abc_a_"

Hello!
This is my first time trying to use Dynamo and I’m excited to learn but keep running into an issue with families named in the “abc_a_” format.
I’ve managed to iterate through all the families searching for “abc-a-” (and a bunch of other variations of this) and replace with “”, and my watch block shows my list after replacing string names is correct but the final list of family names when they go through the element.setname shows any family with “abc_a_” or “abc_abc_” does not get replaced with “”.

image

I used

for x in list:
if “abc_a_” in x:
newlist.append(x.replace(“abc_a_”,“”))
elif “abc-b_” in x:
newlist.append(x.replace(“abc-b_”,“”))
#and so on
else
newlist.append(x)

this results in a list that is correct where everything has been replaced, but after element.setname the issue occurs where all except those with the “abc_a_” in their name have been replaced

The screenshot not 9f a quality we can read, can you repost a screenshot using the camera funtion in dynamo, zoom right into one node and press it. It will capture the whole graph

Can you run the graph before exporting the view, setting up the dataset to show the undesired behaviour you are seeing in the watch nodes? Otherwise we are only able to guess.