There is this issue I have been thinking for some time. I have replacement rules for some string transformation job. I am learning regex and slowly finding correct patterns, this is no problem. However, there are many rules in this and I could not do them in a single expression. And now the processes are overlapping. Let me give you a simple example.
Imagine I want to replace every 'a' with 'o' in a string.
I also want to replace every 'o' to 'k' in the same string, however, there is no order, so if I apply the previous rule first, then the converted 'a's now will become 'k', which simply is not my intention. Because all convertions must have the same priority or precedence. How can I overcome this issue ?
I use re.sub(), but I think same issue exists for string.replace() method.
All help appreciated, Thank you !