Search In This Blog

2016-09-27

[Regex]Check English / Spanish / Franch / Arabic characters

Keep these here as a memo.


English characters:
Public Boolean checkEnglish(String value){
    return Pattern.matches('[^a-zA-Z0-9 ]+', value);
}

Spanish characters:
Public Boolean checkSpanish(String value){
    return Pattern.matches('^[0-9a-zñáéíóúü]+', value);
}

France characters:
Public Boolean checkFrance(String value){
    return Pattern.matches('[^a-zA-Z0-9 àâäèéêëîïôœùûüÿçÀÂÄÈÉÊËÎÏÔŒÙÛÜŸÇ]', value);
}
Arabic characters:
Public Boolean checkArabic(String value){
    return Pattern.matches('^[\u0621-\u064A]+', value);
}
Add 1-9 to Arabic characters:
Public Boolean checkArabicWithNumber(String value){
    return Pattern.matches('^[\u0621-\u064A0-9 ]+', value);
}
Or add number by the range of Arabic numbers
Public Boolean checkArabicWithNumber(String value){
    return Pattern.matches('^[\u0621-\u064A\u0660-\u0669 ]+', value);
}

No comments:

Post a Comment