首页  编辑  

别名方式替换

Tags: /C#/字符串处理/正则表达式/   Date Created:

string s = "{string1}={string2}" ;

Match vMatch = Regex . Match(s, @"^\{(?<name>.+)\}=\{(?<value>.+)\}$" );

Console . WriteLine(vMatch . Result( "${name}" ));

Console . WriteLine(vMatch . Result( "${value}" ));