Page 1 of 1

Find Greek characters using regex

Posted: Sat Apr 07, 2018 12:39 pm
by danielrr
HI all!

I have a few questions concerning using regex to find strings in Ancient Greek, but I think I will be able to solve most of them if I knew the way to find any string containing just Ancient Greek text in livecode. (something like [Α-Ωα-ω] will omit any accented character).

In plain English, how do I build, for example, the regex to find any Greek word of 5 chars, or any Greek word with first character Ἀ?

best,

Daniel

Re: Find Greek characters using regex

Posted: Sat Apr 07, 2018 2:22 pm
by bogs
Probably one of the best regex pages I've come across is this one.

Re: Find Greek characters using regex

Posted: Sat Apr 07, 2018 4:06 pm
by danielrr
I'll put it another way: Greek letter lambda (λ) is Unicode 955, hex U+03BB and in languages like python "\u03bb". how do you represent Unicode characters like lambda in regex expressions using livecode? and how do you set the range of characters to look for when searching for Unicode characters?

Re: Find Greek characters using regex

Posted: Sat Apr 07, 2018 6:30 pm
by bwmilby
See this page for details:

http://www.pcre.org/original/doc/html/pcrepattern.html

You can use "\p{Greek}"

For the specific example, use "\x{03bb}"

Re: Find Greek characters using regex

Posted: Sun Apr 08, 2018 2:08 pm
by danielrr
oh, that's great!. Almost all my questions answered in just one post! thanks bwmilby :D