© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•11mo ago•
4 replies
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
string
and
StringBuilder
StringBuilder
. Now onto
Regex
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)
Regex.Replace(intialString, pattern, replacement)


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


But how to replace it
initialString[len - i - 1]
initialString[len - i - 1]
with
initialString[i]
initialString[i]
character of the string
initialString
initialString
?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Is it possible to subtract a character from a string?
C#CC# / help
4y ago
✅ Is it possible to Parse a string and identify it's type?
C#CC# / help
17mo ago
✅ Need help with regular expression pattern
C#CC# / help
11mo ago