The re.sub method doesn't replace a string in place. It can't, since strings in Python are immutable. When you do a substitution on a string, it returns a new string with the requested changes (or the original string if there was no match). You're currently ignoring the return value, so your code has no effect.

But I don't think you actually need regular expressions at all for this issue. If you want to replace any string that mentions the word super anywhere with the string "superintendent", you can use a simple substring test:

for i, item in enumerate(list_of_strings):
    if "super" in item:
        list_of_strings[i] = "superintendent"

This will of course be more prone to false-positives than using your current regex. You could still use the structure of the code above with a regex search if you want (just change the if "super" in item: line to if re.search(pattern, item): after setting pattern to a regex that matches the strings you want it to).

Answer from Blckknght on Stack Overflow
๐ŸŒ
Real Python
realpython.com โ€บ replace-string-python
How to Replace a String in Python โ€“ Real Python
October 22, 2025 - As you can see, you can chain .replace() onto any string and provide the method with two arguments. The first is the string that you want to replace, and the second is the replacement. Note: Although the Python shell displays the result of .replace(), the string itself stays unchanged.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_string_replace.asp
Python String replace() Method
Remove List Duplicates Reverse ... Study Plan Python Interview Q&A Python Training ... The replace() method replaces a specified phrase with another specified phrase....
Discussions

python - Replacing entire string if there is a matching word - Stack Overflow
I've got a large list of words that I'm trying to cleanup. A number of those words appear multiple times written a little differently every time and I would like to normalize them. For instance I w... More on stackoverflow.com
๐ŸŒ stackoverflow.com
python regex sub replace the whole string - Stack Overflow
Let's say I want to replace string that start with abc with replacement: import re s = 'abcdefg' re.sub(r'^abc', 'replacement', s) replacementdefg What should I do to only return replacement ins... More on stackoverflow.com
๐ŸŒ stackoverflow.com
May 15, 2020
Python regex replace whole string - Stack Overflow
Your whole pattern matches that is why it is replacing the whole string. More on stackoverflow.com
๐ŸŒ stackoverflow.com
January 16, 2015
python - Search and replace with "whole word only" option - Stack Overflow
All the strings to be replaced are joined into a single pattern so that the string needs to be looped over just once. The source strings are passed to re.escape to make avoid interpreting them as regular expressions. The words are surrounded by r'\b' to make sure matches are for whole words only. More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-string-replace-function-in-python-for-substring-substitution
Python String.Replace() โ€“ Function in Python for Substring Substitution
January 24, 2022 - When using the .replace() Python method, you are able to replace every instance of one specific character with a new one. You can even replace a whole string of text with a new line of text that you specify.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-string-replace
Python String replace() Method - GeeksforGeeks
July 7, 2026 - A new string is returned with the updated values, original string s remains unchanged. ... count (optional): Specifies the maximum number of replacements to perform.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ string โ€บ replace
Python String replace()
If the old substring is not found, it returns a copy of the original string. ... # replacing 'cold' with 'hurt' print(song.replace('cold', 'hurt')) song = 'Let it be, let it be, let it be, let it be'
๐ŸŒ
StrataScratch
stratascratch.com โ€บ blog โ€บ how-to-replace-a-character-in-a-python-string
How to Replace a Character in a Python String - StrataScratch
October 18, 2024 - The basic method for replacing a string in Python is intuitively named str.replace(). It allows you to specify one character or a whole substring you want to replace and a character (or a substring) you want to replace it with.
Find elsewhere
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ string_replace.htm
Python String replace() Method
But, since we have passed the count as 0, this method does not modify the current string, instead of that, it returns the original value ("Learn Python from Tutorialspoint"). str = "Learn Python from Tutorialspoint" strreplace = str.replace("Python", "Java", 0) print("String after replacing: " + strreplace)
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ python-string-replace
Python String replace() | DigitalOcean
August 3, 2022 - Technical tutorials, Q&A, events โ€” This is an inclusive place where developers can find or lend support and discover new ways to contribute to the community.
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ string-replace-method
Master Python's String Replace Method for Text Manipulation
The default value (-1) replaces all occurrences. The syntax of this method ensures clarity and flexibility, allowing developers to easily modify strings without altering the original data. In the Python programming languages, replace() is useful for replacing characters and other substrings within strings.
๐ŸŒ
Server Academy
serveracademy.com โ€บ blog โ€บ python-replace-function
Python Replace() Function Blog | Server Academy
November 14, 2024 - The method in Python is a powerful tool for working with strings, allowing you to replace parts of a string with new values. Whether youโ€™re changing charactersโ€ฆ
๐ŸŒ
YouTube
youtube.com โ€บ real python
Replacing a String In a String in Python - YouTube
This a preview of a video course about replacing strings in Python. If youโ€™re looking for ways to remove or replace all or part of a string in Python, then t...
Published: August 24, 2023
Views: 1K
๐ŸŒ
Medium
medium.com โ€บ @pies052022 โ€บ python-string-replace-method-explanation-with-example-program-3fbd2f33f812
Python String replace() Method: Explanation with Example Program | by JOKEN VILLANUEVA | Medium
March 13, 2026 - ... Using the Python .replace() function, you may replace every occurrence of a certain character with another. You may even replace a whole string of text with a specified new line of text.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python-replace-all-occurrences-of-a-substring-in-a-string
Python - Replace all occurrences of a substring in a string - GeeksforGeeks
January 8, 2025 - This method manually searches for the target substring and replaces it with the desired string. ... replace() method in Python allows us to replace a specific part of a string with a new value. It returns a new string with the change without ...
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Replace Strings in Python: replace(), translate(), and Regex | note.nkmk.me
May 4, 2025 - You can pass a dictionary to str.maketrans(), where each key is a single character to be replaced, and the corresponding value is the replacement string or None to remove it.
๐ŸŒ
Keploy
keploy.io โ€บ home โ€บ community โ€บ how to replace strings in python?
How to Replace Strings in Python: Methods, Examples & Best Practices
September 26, 2025 - Learn how to replace strings in Python using replace(), slicing, list conversion, translate(), and regex with simple examples.
๐ŸŒ
Kanaries
docs.kanaries.net โ€บ topics โ€บ Python โ€บ python-string-replace
Python String Replace: Complete Guide to str.replace() and Beyond โ€“ Kanaries
February 10, 2026 - Use str.replace(old, new) for simple replacements: "hello world".replace("world", "python") returns "hello python". This replaces all occurrences.