I have a string which looks like below
string = "SELECT sdfdsf SELECT sdrrr SELECT 5445ff"
Now I want to replace every occurrence of SELECT except the first one with @@@SELECT so that in the end string looks like this
"SELECT sdfdsf @@@SELECT sdrrr @@@SELECT 5445ff"
Now Python replace() replaces all occurrence of SELECT.
string = string.replace("SELECT", "@@@SELECT)
So the string becomes
"@@@SELECT sdfdsf @@@SELECT sdrrr @@@SELECT 5445ff"
How do I ensure except the first instance, everything else is replaced?
Note: The string can have n occurrences of SELECT