Reputation: 6159
I'm trying to use regex_replace in c#
This are my strings
my\old\path\Win32\my.dll
my\old\path\Win64\mydll2.dll
I'm trying to replace them with
my\new\path\Win32Release\my.dll
my\new\path\Win64Release\mydll2.dll
This is how I do it and doesn't work in c# but works in notepad++
Regex.Replace(test, @"\bmy\\old\\(.*)\\[a-z]+([0-9]{2})\\((.*)+\.[a-z]{3})\b", @"my\\new\\path\\Win\2Release\\\3")
Upvotes: 0
Views: 215
Reputation: 89557
Your pattern doesn't work because you have forgotten to make it case-insensitive. You can add (?i)
at the begining of the pattern or use RegexOptions.IgnoreCase
Upvotes: 2