views:

130

answers:

2
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?

+4  A: 

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.

Fredrik Mörk
Don't worry, i 'll submit a ticket! http://www.kli.org/
Chocol8
A: 

This one is brilliant also! Found at a1vbcode.com

Public Function IntlIsAlphaCharacter(sChar As String) As Boolean
    IntlIsAlphaCharacter = (Not (UCase(sChar) = LCase(sChar))) Or (sChar = " ")
End Function

The native language of klingons is regex's?

Chocol8