本文介绍了取适量涂抹于流正则表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找快速和安全的方式申请普通防爆pressions上流。

I'm searching for fast and safe way to apply Regular Expressions on Streams.

我发现了一些例子在互联网上谈论每个缓冲区转换为字符串,然后应用正则表达式的字符串。

I found some examples over the internet that talking about converting each buffer to String and then apply the Regex on the string.

这个方法有两个问题:

  • 性能:转换为字符串,并GC'ing字符串是时间和CPU,并确保废弃物可避免,如果有采用更原始的方式正则表达式的流
  • 正则表达式支持:正则表达式模式有时只能匹配,如果合并两个缓冲区在一起(缓冲区1的结束本场比赛的第一部分,和缓冲区2开始与本场比赛的第二部分)。转换到字符串的方法无法处理这种类型的本地配套,我必须提供更多的像的最大长度信息,该模式可以匹配,这种不支持+和*正则表达式的迹象都绝不会支持(无限比赛长度)。
  • Performance: converting to strings and GC'ing the strings is waste of time and CPU and sure can be avoided if there was a more native way to apply Regex on Streams.
  • Pure Regex support: Regex pattern sometimes can match only if combining two buffers together (buffer 1 ends with the first part of the match, and buffer 2 starts with the second part of the match). The convert-to-string way cannot handle this type of matching natively, I have to provide more information like the maximum length that the pattern can match, this does not support the + and * regex signs at all and will never support (unlimited match length).

所以,转换到字符串的方式并不快,而且不完全支持正则表达式

So, the convert-to-string way is not fast, and doesn't fully support Regex.

有没有可用于正则表达式适用于流而不转换为字符串,并以饱​​满的正则表达式的支持?

Is there any way / Library that can be used to apply Regex on Streams without converting to strings and with full Regex support?

推荐答案

也许这篇文章可以帮助?虽然我想这可能是你发现有帮助的不是在互联网上的东西。

Perhaps this article could help? Though I suppose it might be the "things on the internet" you found that weren't of help.

<一个href="http://www.developer.com/design/article.php/3719741/Building-a-Regular-Ex$p$pssion-Stream-Search-with-the-NET-Framework.htm"相对=nofollow>建立一个普通防爆pression流搜索与.NET Framework

这篇关于取适量涂抹于流正则表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 15:04