tags:

views:

36

answers:

3

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
A: 

Is this C#? If it is, then this would work:

Regex.Replace("Resources.AppResource.Info;", @"Resources\.AppResource\.(\w+);", @"Switch(""$1"")")
AHM
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