Symbols

Is any way to identify something like this in a text: أنطونيو أسيفيدو?
Parents
  • Hi ,

    Although this question isn't really related to sugar more like a Programming question I found it interesting. (coz I personally never thought of this)

    I'm not sure what is your intention here but I've tested some stuff that probably can give you idea to wrap a function using combination of it. 

    <?php
    $is_arabic = preg_match('/\p{Arabic}/u', " sadfdasf أنطونيو أسيفيدو");
    echo "is_arabic: ".var_export($is_arabic, true);
    echo PHP_EOL;
    $is_not_arabic = preg_match('/\p{Arabic}/u', "sadfdasf");
    echo "is_not_arabic: ".var_export($is_not_arabic, true);
    echo PHP_EOL;
    $is_numeric_arabic = preg_match('/^\p{N}+$/u', "١٢٣٤٥" /*Arabic numerals for "12345"*/);
    echo "is_numeric_arabic: ".var_export($is_numeric_arabic, true);
    echo PHP_EOL;
    $is_not_numeric_arabic = preg_match('/^\p{N}+$/u', "أنطونيو أسيفيدو");
    echo "is_not_numeric_arabic: ".var_export($is_not_numeric_arabic, true);


    You can see the results of it here:
    https://3v4l.org/rrbML

    Hope this helps.

    Tevfik Tümer
    Sr. Developer Support Engineer 

Reply
  • Hi ,

    Although this question isn't really related to sugar more like a Programming question I found it interesting. (coz I personally never thought of this)

    I'm not sure what is your intention here but I've tested some stuff that probably can give you idea to wrap a function using combination of it. 

    <?php
    $is_arabic = preg_match('/\p{Arabic}/u', " sadfdasf أنطونيو أسيفيدو");
    echo "is_arabic: ".var_export($is_arabic, true);
    echo PHP_EOL;
    $is_not_arabic = preg_match('/\p{Arabic}/u', "sadfdasf");
    echo "is_not_arabic: ".var_export($is_not_arabic, true);
    echo PHP_EOL;
    $is_numeric_arabic = preg_match('/^\p{N}+$/u', "١٢٣٤٥" /*Arabic numerals for "12345"*/);
    echo "is_numeric_arabic: ".var_export($is_numeric_arabic, true);
    echo PHP_EOL;
    $is_not_numeric_arabic = preg_match('/^\p{N}+$/u', "أنطونيو أسيفيدو");
    echo "is_not_numeric_arabic: ".var_export($is_not_numeric_arabic, true);


    You can see the results of it here:
    https://3v4l.org/rrbML

    Hope this helps.

    Tevfik Tümer
    Sr. Developer Support Engineer 

Children
No Data