Thursday, 15 April 2010

c# - regular expressions with the Cyrillic alphabet? -



c# - regular expressions with the Cyrillic alphabet? -

i writing validation validate inputted data. using regular expressions so, working c#.

password = @"(?!^[0-9]*$)(?!^[a-za-z]*$)^([a-za-z0-9]{6,18})$" validate alpha numeric = [^a-za-z0-9ñÑáÁéÉíÍóÓúÚüÜ¡¿{0}]

the above work fine on latin alphabet, how can expand such working cyrillic alphabet?

the basic approach covering ranges of characters using regular expressions build look of form [a-za-z], a first letter of range, , z lastly letter of range.

the problem is, there no such thing "the" cyrillic alphabet: alphabet different depending on language. if cover russian version of cyrillic, utilize [А-Яа-я]. utilize different range, say, serbian, because lastly letter in cyrillic Ш, not Я.

another approach list characters one-by-one. find authoritative reference alphabet want set in regexp, , set characters pair of square brackets:

[АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя]

c# regex latin

No comments:

Post a Comment