I\'ve noticed a lot of little debates about when to use regex and when to use a built in string function like String.Replace() (.NET).
It seems a lot of people recom
Obviously, for complex search/match/replace operations, regexes are the way to go. For simple stuff like replacing a single word by another word, normal string methods are preferred.
But in many cases, it's not that simple. Sometimes you come across a situation where you could use standard string operations, while the regex solution is more elegant. Even if the vanilla string algorithm is 10 times faster, it's always a good idea to ask yourself if it matters in that particular piece of code (for example if the code isn't executed in a loop).
I would prefer the readability of a simple regex operation over a more complex, but faster algorithm using pure string operations.
Just my 2 cents...