用键码数据替换正则表达式
Public ReadOnly Property IsAlphaNumeric(ByVal entry As String) As Boolean
Get
Return New Regex("(?!^[0-9]*$)(?!^[a-zα-ωA-ZΑ-Ω]*$)^([a-zα-ωA-ZΑ-Ω0-9]{6,15})$", RegexOptions.IgnoreCase).IsMatch(entry)
End Get
End Property
这对于希腊语和英语来说非常好。
宇宙中所有其他语言又如何呢?
我应该用另一个函数替换上面的代码,验证键码数据和文本长度还是什么?
Public ReadOnly Property IsAlphaNumeric(ByVal entry As String) As Boolean
Get
Return New Regex("(?!^[0-9]*$)(?!^[a-zα-ωA-ZΑ-Ω]*$)^([a-zα-ωA-ZΑ-Ω0-9]{6,15})$", RegexOptions.IgnoreCase).IsMatch(entry)
End Get
End Property
This one is pretty good for Greek and English language.
What about all the other languages in the universe?
Should i replace the above code with another function, validating keycode data and text length or what?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议改用 unicode 字符定义,例如
\p{L}
表示字母,\p{N}
表示数字。您可以找到有关 MSDN 上识别的类别的文档 。
但是,我不确定它是否支持克林贡字母。
I would recommend to use unicode character definitions instead, such as
\p{L}
for letters and\p{N}
for numbers.You can find documentation on which categories that are recognized at MSDN.
However, I am not sure whether it supports the Klingon alphabet.
这个也很精彩!发现于 a1vbcode.com
克林贡语的母语是正则表达式的?
This one is brilliant also! Found at a1vbcode.com
The native language of klingons is regex's?