I trying to replace string "Resources.AppResource.Info;" like this "Switch("Info");" Is this possible with regex?
A:
You should include the programming language you are working with. And I'm guessing its C#.
string info = System.Text.RegularExpressions.Regex.Replace("Resources.AppResource.Info;", @"\w+\.\w+\.(\w+);", "Switch($1);");
Ruel
2010-10-04 13:01:31
A:
Is this C#? If it is, then this would work:
Regex.Replace("Resources.AppResource.Info;", @"Resources\.AppResource\.(\w+);", @"Switch(""$1"")")
AHM
2010-10-04 13:01:38
A:
Your question is confusing, a code example would really help, with input and expected output. How does the middle of the string help?
If I understand right you probably want a substitution of one string for another.
Here's some sed, something similar would work for vi and perl
s/Resources\.AppResource\.Info/Switch\("Info"\)\;/
This would work in ruby
app_string.gsub("Resources.AppResource.Info;",
'Switch("Info")';
Paul Rubel
2010-10-04 13:07:53