SQLite Forum

regexp for Unicode ranges
Login
I pondered for a while… Is μ or Ω really a Greek letter? Wait a second before you object.
If I try the following:
sqlite> select 'Ω' regexp '\p{Latin}';
1
sqlite> 

So the PCRE library considers this to be a letter not belonging to the Greek alphabet.
Or is something else going on?
The syntax is \p{unicode property or \p{unicode script}

The property option I normally use for, for example, searching for a symbol like
\p{S} or \p{Sm} if you only want to test for mathematical symbols.

So let's try this:
 sqlite> select 'Ω' regexp '\p{S}';
1
sqlite> 
I was lucky. Because all other Greek letters are probably not a symbol.
sqlite> select '≤' regexp '\p{S}';
1
sqlite> 
Which is indeed a symbol.
I've never used or seen a colleague using /p{Greek} or /p{Latin}. What I've seen is using /p to do some freaky complex searching like, for example, \p{lu} search for an uppercase letter that has a lower case variant.