I have made a multi lingual extension API for string which can identify if a string (in different languages) is AlphaNumeric. The API uses Regular Expression support for Unicode.
IsAlphaNumeric - String must contain atleast 1 alpha (letter in Unicode range, specified in charSet) and atleast 1 number (specified in numSet). Also, the string should comprise only of alpha and numbers.
The charSet/numSet Unicode range for the desired language can be specified. The Unicode ranges are available on below link:
http://www.ssec.wisc.edu/~tomw/java/unicode.html
API:
public static class Extension
{
public static bool IsAlphaNumeric(this string stringToTest)
{
//English
const string charSet = "a-zA-Z";
const string numSet = @"0-9";
//Greek
//const string charSet = @"\u0386\u0388-\u03F3";
//const string numSet = @"0-9";
//Bengali
//const string charSet = @"\u0985-\u09E3";
//const string numSet = @"\u09E6-\u09EF";
//Hindi
//const string charSet = @"\u0905-\u0963";
//const string numSet = @"\u0966-\u096F";
//Japanese Hiragana
//const string charSet = @"\u3041-\u3094";
//const string numSet = @"0-9";
//Hebrew
//const string charSet = @"\u05D0-\u05EA";
//const string numSet = @"0-9";
//Latin basic and Supplement. German, French etc.
//const string charSet = @"a-zA-Z\u00C0-\u00FF";
//const string numSet = @"0-9";
return Regex.Match(stringToTest, @"^(?=[" + numSet + @"]*?[" + charSet + @"]+)(?=[" + charSet + @"]*?[" + numSet + @"]+)[" + charSet + numSet + @"]+$").Success;
}
}
Usage: