Find some text characters

Peter Bogdanoff bogdanoff at me.com
Tue Jul 18 00:31:15 EDT 2017


Thierry, I ended up using your first Regex example—works great!

It is very good to know about \p{} matches—everything from Arabic to Yi. That may come in handy later.

Thanks,

Peter

> On Jul 17, 2017, at 8:54 PM, Thierry Douez via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 2017-07-18 3:53 GMT+02:00 Thierry Douez <th.douez at gmail.com>:
> 
>> 
>>> I want to know if this data contains Chinese characters
>>> 
>>> Thanks for suggestions!
>>> 
>>> Peter Bogdanoff
>>> 
>>> 
>> ​Hi Peter,
>> 
> 
> 
> ​Ok, back after my second morning coffee :)
> 
> A better way to check for Chinese code points would be
> something like that (not tested and never used myself) :
> 
> 
> function testForChinese utf8Text
>   return matchText( utf8Text, "\p{Han}")
> end testForChinese
> 
> Of course, it won't work with  htmlText, but straight with
> the text of a field, assuming it's coded in UTF8 !!!
> 
> 
> HTH,
> 
> Thierry
>> 
>>>> ​Mmm, not sure you'll get *only* Chinese characters,
>> but at least any entity with only 5 numbers.
>> 
>> This function returns true if find any, false otherwise:
>>>> function testForChinese T
>> ​xt​
>> ​ -- any htmltext​
>>   return matchText(
>> ​Txt
>> , "&#\d{5};")
>> end testForChinese
>> 
>> ​Regards,
>> 
>> Thierry​
>> 
> 
> 
> -- 
> ------------------------------------------------
> Thierry Douez - sunny-tdz.com
> sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list