[luatex] problem with slnunicode's find

Stephan Hennig mailing_list at arcor.de
Tue Mar 2 13:45:31 CET 2010

Hi Patrick,

Am 02.03.2010 07:46, schrieb Patrick Gundlach:
>> Hmm, neither do I want to cut something nor do I have a range
>> available.  I just want to count.  Attached is my attempt of a utf8
>> aware find function based on the utf8 aware parts of slnunicode.
>> Comments and improvements are welcome!
> What is wrong with
> str="äöABCäö"
> b,e = unicode.utf8.find(str,"%u+")
 > print(string.sub(str,b,e))
> print("count=" .. tostring(e - b + 1))
> ?

That counts the length of a match as long as that contains no characters 
above code point 127.  (It fails for str="äaöAÄBCäö".)

Anyway, what I want is the position of the match.  In your example the 
result would be 3, but the values of b and e are 5 and 7.  I can't see 
how that tells me anything.  Is there something that I'm overlooking?

Best regards,
Stephan Hennig

More information about the luatex mailing list