SyntaxFix
Write A Post
Hire A Developer
Questions
You can do this using lookahead and lookbehind:
var pattern = @"(?<=-)\d+(?=-)"; var replaced = Regex.Replace(text, pattern, "AA");