© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
2 replies
rokibox

✅ Replace regex-pattern with dynamically generated string.

I have a text and a regex pattern. I want to take each of the substrings that match the pattern and replace them NOT with a constant string, but with a dynamically generated string from a method. For example, so that all occurrences are IEnumerable and I can use .Select()) to change each one so that they are overwritten in the initial text in the correct order. How can I do this?
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

❔ confused with regex pattern
C#CC# / help
3y ago
❔ How to replace string.IsNullOrWhiteSpace() with pattern matching?
C#CC# / help
3y ago
Please help me with regex pattern
C#CC# / help
4y ago
❔ trim string according to regex
C#CC# / help
3y ago