字符串截取问题,谢谢!
本帖最后由 zhangyi2013 于 2013-09-29 15:44:19 编辑 如何把这个字符串:"metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.1.231;initial catalog=student;persist security info=True;user id=sa;password=123456;multipleactiveresultsets=True;App=EntityFramework""通过截取后得到 data source=192.168.1.231;initial catalog=student;persist security info=True;user id=sa;password=123456
谢谢。
[解决办法]
Regex regx = new Regex("(?=data source).*?(?=password).*?;");
Match match = regx.Match("metadata=res://*/DataModel.csdl
[解决办法]
res://*/DataModel.ssdl
[解决办法]
res://*/DataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.1.231;initial catalog=student;persist security info=True;user id=sa;password=123456;multipleactiveresultsets=True;App=EntityFramework"");
string value = match.Value;