Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

regex

dfa

nfa

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.

like image 897
Pranav Shah Avatar asked Oct 15 '25 09:10

Pranav Shah


1 Answers

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.

like image 62
Srivathsal Avatar answered Oct 16 '25 22:10

Srivathsal