简体   繁体   English

正则表达式到C#正则表达式

[英]Regex to C# regex

I found a regular expressions that would find: 我发现一个正则表达式可以找到:

bb:hhhh="blajkeh32;,,;sekj;f!!!;"

that would also find: 还会发现:

bb:hhhh="blfsefsefsajkehsdfsdfse32;,,efsefesekj;f!!!;"

where: 哪里:

bb:hhhh=""

is constant. 是恒定的。

I used this: 我用这个:

bb\:hhhh:b*=:b*\"[^\"]*\" 

But, now, I want to write this in C# for a System.Text.RegularExpressions.Regex.Replace function call, and I don't know how to convert this regex to a string that will work in c#. 但是,现在,我想用C#编写此代码以用于System.Text.RegularExpressions.Regex.Replace函数调用,而且我不知道如何将此正则表达式转换为可在c#中使用的字符串。

I've tried the following in C#: 我已经在C#中尝试了以下方法:

System.Text.RegularExpressions.Regex.Replace(File.ReadAllText(filePath1), @"dc\:source:b*=:b*""[^""]*""", ""));

这是匹配bb:hhhh =“到”

var resultString = System.Text.RegularExpressions.Regex.Match(subjectString, "bb:hhhh=\"[^\"]*\"").Value;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM