就像 VB.NET 中的运算符(有时)比正则表达式更好、更容易?
我真的很喜欢使用 VB.NET 的 Like 运算符。它足以满足我的大部分用途,而且我确信这对于“普通”开发人员来说也是如此。
我避免使用正则表达式的主要原因之一是语法很复杂,乍一看很难看出发生了什么。 Like 运算符使用万无一失的语法。
是只有我一个人有类似的看法,还是其他人也有类似的看法?同样,是否存在“简化”正则表达式表示法。
Like 运算符: http://msdn.microsoft.com /en-us/library/swf8kaxw(v=vs.71).aspx
I really enjoy using Like operator of VB.NET. It suffices for the majority of my uses, and I am sure this is true for the 'average' developer.
One of the main resason I avoid regexes is that the syntax is complicated and it is hard to see at first glance what is happening. The Like operator uses fool-proof syntax.
Is it just me, or do other people have similar views? On the same note, is there such than as a 'simplified' regex notation.
Like operator: http://msdn.microsoft.com/en-us/library/swf8kaxw(v=vs.71).aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会使用贵公司规定的任何标准,或者,如果不适用,则使用您个人标准规定的任何标准。
有些人非常熟悉正则表达式,并且更喜欢完整的语法。其他人则不喜欢,并且可能更喜欢
Like
运算符(在我的环境中,很多人从 T-SQL 世界转向 .NET,因此Like
运算符是非常熟悉)。此外,根据文档,
Like
运算符可以重载,以便您可以利用它来比较您自己的类型,而不仅仅是字符串
。I would use whatever your company's standards dictate or, if that's not applicable, whatever your personal standards dictate.
Some people are intimately familiar with Regular Expressions and would prefer the complete syntax. Others are not and may be more comfortable with the
Like
operator (in my environment, a lot of folks cross from the T-SQL world to .NET so theLike
operator is very familiar).Additionally, as per the documentation, the
Like
operator can be overloaded such that you can utilize it for comparison on your own types, as opposed to juststrings
.