Text To Upper with Bulleted lists

I am experiencing a confusing behavior of a simple script to change text notes to upper case. When I run it on a note that has bulleting, the text changes like expected but the bulleting formatting gets reset.

The image shows a text not and a portion I want to change to uppercase. However, after running the script, it looks like this. This is not the behavior I expected. Is this a known issue with this method?

I attached my script below for reference. Short and simple

It’s complicated.
Revit has the text.
And it has the formatted text.
The formatted text isn’t some nice set of codes like the good old days and WordPerfect 5.1. It is a bunch of text ranges and lots of get and set methods.
I’m surprised any text node works.
For you’re reading enjoyment:
https://forum.dynamobim.com/t/replace-specific-text-in-text-note-maintain-list-numbering/59059

Thanks for the response and I am not surprised in the least that it is unnecessarily complicated. I did enjoy reading that thread and decided it is much easier to just preface the tool with a little disclaimer about bulleted text.