কম্পিউটার টিউটোরিয়াল

জাভায় Pattern UNICODE_CHARACTER_CLASS ফিল্ড উদাহরণসহ ব্যাখ্যা

পারদিভাষিত ক্যারেক্টার ক্লাস এবং POSIX ক্যারেক্টার ক্লাসের ইউনিকোড সংস্করণ সক্ষম করে।

উদাহরণ

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class UNICODE_CHARACTER_CLASS_Example {
    public static void main(String args[]) {
        String regex = "\u00de";
        
        // রেগুলার এক্সপ্রেশন কম্পাইল
        Pattern pattern = Pattern.compile(regex, Pattern.UNICODE_CHARACTER_CLASS);
        
        // Matcher অবজেক্ট পাওয়া
        String str[] = {"\u00de", "\u00fe", "\u00ee", "\u00ce"};
        
        for (String ele : str) {
            Matcher matcher = pattern.matcher(ele);
            if(matcher.matches()) {
                System.out.println(ele + " is a match for " + regex);
            } else {
                System.out.println(ele + " is not a match for " + regex);
            }
        }
    }
}

আউটপুট

Þ is a match for Þ
þ is a match for Þ
î is not a match for Þ
Î is not a match for Þ
  1. জাভায় Pattern LITERAL ফিল্ড উদাহরণসহ ব্যাখ্যা

  2. জাভায় Pattern DOTALL ফিল্ড উদাহরণসহ ব্যাখ্যা

  3. জাভায় Pattern COMMENTS ফিল্ড উদাহরণসহ ব্যাখ্যা

  4. জাভায় Pattern CANON_EQ ফিল্ড উদাহরণসহ ব্যাখ্যা