开发者

Has anyone used RE2 in a C# application? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. 开发者_如何转开发

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 6 months ago.

Improve this question

I started my search a for a decent Regular Expression engine. It landed me to this page Benchmark of Regex Libraries. I decided to use RE2 because it seems to be the best FSA engine in this list.

My final application will be built using WPF in C#. The regex library will be used more in batch mode. However most of the other Business Logic will be written in C# and thus I am planning on using the RE2 library through C#.

If anyone has done anything similar or just used the RE2 through C# and has some advice or pointers please tell me about it.

Thanks.


I have used RE2 .Net in an application, and let me tell you that this is best regex filtering tool ever. It has given me more than 10x improvement in the performance in most cases.

You can download the source code which is in C++ and the .net libraries here, https://github.com/0xcb/Re2.Net

It depends on your requirement though. If you have a text file and if the need is to filter the file using a list of regular expressions then I would recommend GREP. If you are trying to filter a large data set using a huge set of regex's where performance is a concern, then you could go with RE2. But, beware of the limitations in the syntax which are listed in https://code.google.com/p/re2/wiki/Syntax.


Yeah, I'm with Daniel on this one . . . before I'd go hunting from some rogue implementation of Reg Exp . . . I'd make sure I was pre-compiling regular expressions where I could, that greedy options, etc were all set correctly and that the reg expression themselves were not "dumb" in some way . . .

I suspect replacing the standard package is not the optimal solution. Of course without knowing more about your requirements it is hard to know for sure . . . but if the impact of the RegExp package is that huge on your performance, I'd look at the RegExp's themselves first.

Frank

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜