none
c# Regular expression and unicode text RRS feed

  • Question

  • I am trying to test next regex.

    string PATTERN=@"^[@£$¥èéùìòÇØøÅå_ÆæßÉ!""#%&'()*+,-./0123456789:;<=>? ¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà^{}\[~]|€]+$";
    
    
    public static bool IsMatch(string message)
            {
                var strMap = new Regex(PATTERN);
                return strMap.IsMatch(message);
            }

    i make next tests :

    string english_only = "dsfsdfsdf"; string Arabic_only = "دين الق"; string english_arabic_mix = "mixed englih with ك الدين القيم فل";

    if test english_only =>i get true //correct

    if test Arabic_only =>i get false //correct

    if I test english_arabic_mix ii get true

    but what I want to achive that if there are some letter not from the PATTERN to get false (

    and as you can see in my test with english_arabic_mix i got true.

    how can I fix the regEx test so if there is some letter not part of the patter the match will fail?


    Thursday, June 20, 2019 4:01 PM

Answers

All replies