English 中文(简体)
构建regex 以查找字符串
原标题:Build regex to find a string
  • 时间:2012-05-25 10:29:02
  •  标签:
  • c#
  • regex

我需要在接下来的路上找出潜质

starting with semicolon or fullstop after that one compulsory word with double quotation mark in that entire substring and finally substring ends with fullstop or semicolon. any suggetion to build a regex??

consider the following input in this I need to find explanation of double quoted words.See the output what I want. Thanks

输入 :

2. “公平成员”是指姓名和地址分别列于附件A第1部分的人,以及根据第11条规定任命的任何其他人; “行为”是指不时修正的2000年《有限责任伙伴关系法》; 任何人的“关系”是指直接或间接通过一个或多个中间人加以控制、受这种人控制或同这种人共同控制的任何个人。 “控制”一词是指直接或间接地拥有权力,通过投票证券的所有权、合同或其他方式,指挥或领导个人的管理和政策;

输出 :

2. “公平成员”是指姓名和地址分别列于附件A第1部分的人,以及根据第11条规定任命的任何其他人;

“行为”是指不时修正的2000年《有限责任伙伴关系法》;

任何人的“关系”是指直接或间接通过一个或多个中间人加以控制、受这种人控制或同这种人共同控制的任何个人。

“控制”一词是指直接或间接地拥有权力,通过投票证券的所有权、合同或其他方式,指挥或领导个人的管理和政策;

问题回答

你的答案是

Match resul = Regex.Match(input, "(;|.)([^;|^.])+(;|.)");

        while (resul.Success)
        {
            MessageBox.Show(resul.Value);
            resul= resul.NextMatch();
        }

请求您。 请不要从堆积流中询问准确的答案。 您可以看到堆积流中的询问标准 。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签