有人在 C# 应用程序中使用过 RE2 吗?

发布于 2024-10-09 19:52:53 字数 1431 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

简单爱 2024-10-16 19:52:53

我在一个应用程序中使用过 RE2 .Net,让我告诉你这是有史以来最好的正则表达式过滤工具。在大多数情况下,它使我的性能提高了 10 倍以上。

您可以在此处下载 C++ 源代码和 .net 库,
https://github.com/0xcb/Re2.Net

这取决于您的要求。如果您有一个文本文件并且需要使用正则表达式列表来过滤该文件,那么我会推荐 GREP。
如果您尝试使用大量正则表达式来过滤大型数据集,并且性能是一个问题,那么您可以使用 RE2。但是,请注意 https://code.google 中列出的语法限制。 com/p/re2/wiki/语法

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.

‖放下 2024-10-16 19:52:53

是的,我和丹尼尔一起讨论这一点。 。 。在我去寻找 Reg Exp 的一些流氓实现之前。 。 。我会确保我尽可能地预编译正则表达式,贪婪选项等都已正确设置,并且 reg 表达式本身在某种程度上不是“愚蠢的”。 。 。

我怀疑更换标准包并不是最佳解决方案。当然,如果不了解更多有关您的要求的信息,就很难确定。 。 。但如果 R​​egExp 包对您的性能的影响那么大,我会首先看看 RegExp 本身。

坦率

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文