关于正则表达式,如何取出中括号中的字符? 比如[Show],如何取出中括号中的"Show"字符? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System;using System.Collections;using System.Text;using System.Text.RegularExpressions;public class MyClass{ public static void Main() { string str = "[Show]"; Regex r; string pattern = ""; pattern = @"\[(?<A>(.)*)\]"; r = new Regex( pattern , RegexOptions.IgnoreCase|RegexOptions.Compiled); str = r.Replace( str, "${A}" ); Console.Write(str); RL(); } private static void WL(string text, params object[] args) { Console.WriteLine(text, args); } private static void RL() { Console.ReadLine(); } private static void Break() { System.Diagnostics.Debugger.Break(); }} Regex myReg=new Regex(@"(?<=\[)(\S*)(?=\])");用这个就行了 bool属性值绑定的时候,能否绑定"两个bool值的逻辑运算"? 图片作背景刷新速度慢! 请教:streamreader读取文本中的某一行 视频播放 C#视频与曲线同步 今天买了本《C#技术内幕》立志学好C# Base-64 字符串中的无效字符 如何用C#复制和下载ftp://服务器上文件到本地? hello,各位,如何用c#在web Form中获得客户端的IP地址?谢谢! 如何获得像资源管理器上的桌面上的我的电脑,网上邻居等等 关于大数据在程序中从informix中导入到sqlserver 这在ASP.NET 中用c#怎么写?
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;public class MyClass
{
public static void Main()
{
string str = "[Show]";
Regex r;
string pattern = "";
pattern = @"\[(?<A>(.)*)\]"; r = new Regex( pattern ,
RegexOptions.IgnoreCase|RegexOptions.Compiled); str = r.Replace( str, "${A}" );
Console.Write(str); RL();
}
private static void WL(string text, params object[] args)
{
Console.WriteLine(text, args);
}
private static void RL()
{
Console.ReadLine();
}
private static void Break()
{
System.Diagnostics.Debugger.Break();
}
}
用这个就行了