[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
regexp strangeness
From: |
Kay Nick |
Subject: |
regexp strangeness |
Date: |
Sat, 8 Feb 2020 09:32:02 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 |
Hey all,
the documentation to regexp says:
'\w'
Match any word character
what exactly is a word character (maybe even more important what isn't)?
Am I right in assuming its
[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]? What about non
english characters like öäßłńŚ?
And here some other strange (to me) behavior:
>> regexp("#w#","#\w#")
ans = 1 <- seems to work in general...
>> regexp("#d#","#\w#")
ans = [](1x0) <- why?
>> regexp("#d#","#\\w#") <- so we need to double escape these
special characters... no mention of that in the help... :-(
ans = 1
>> regexp("#j#","#\\w#")
ans = 1 <- ok
>> regexp("#E#","#\\w#")
ans = 1 <- ok
>> regexp("#E#","#\\w*#")
ans = 1 <- ok
>> regexp("##","#\\w*#")
ans = 1 <- ok
>> regexp("#.#","#\\w*#")
ans = [](1x0) <- why?
Especially the last one >> regexp("#.#","#\\w*#") ans = [](1x0) looks
like a bug to me. Or am I getting something wrong here?
Thanks
Kay
- regexp strangeness,
Kay Nick <=