C#C
C#9mo ago
yourFriend

Is it possible to reverse a string letter by letter using only regular expression?

I am learning string manipulation. Learned a bit about
string
and StringBuilder. Now onto Regex and I'm trying to do everything which I do with string methods and StringBuilder methods by using Regex alone for learning purposes.

But reversing a string letter by letter seems pretty hard by just Regex.Replace(intialString, pattern, replacement)

I guess pattern can be:
string pattern = "."; // Match every character except new line


But how to replace it initialString[len - i - 1] with initialString[i] character of the string initialString?
Was this page helpful?