Re: [racket-users] Are Regular Expression classes Unicode aware?

2020-07-11 Thread Ryan Culpepper
Great, I'm glad it was useful! Ryan On Sat, Jul 11, 2020 at 12:27 PM Peter W A Wood wrote: > Dear Ryan > > Thank you for both your full, complete and understandable explanation and > a working solution which is more than sufficient for my needs. > > I created a very simple function based on th

Re: [racket-users] Are Regular Expression classes Unicode aware?

2020-07-11 Thread Peter W A Wood
Dear Ryan Thank you for both your full, complete and understandable explanation and a working solution which is more than sufficient for my needs. I created a very simple function based on the reg=exp that you suggested and tested it against a number of cases: #lang racket (require test-engin

Re: [racket-users] Are Regular Expression classes Unicode aware?

2020-07-10 Thread Peter W A Wood
Dear Ryan Thank you very much for the kind, detailed explanation which I will study carefully. It was not my intention to reply to you off-list. I hope I have correctly addressed this reply to appear on-list. Peter > On 10 Jul 2020, at 15:47, Ryan Culpepper wrote: > > (I see this went off th

Re: [racket-users] Are Regular Expression classes Unicode aware?

2020-07-09 Thread Sorawee Porncharoenwase
I did in fact try installing readline-gpl (raco pkg install readline-gpl), but it didn’t change anything. Interestingly, the bug in #3223 persists for me, too. This suggests that I didn’t install or invoke it correctly. Do you need to run racket with any flag to make readline-gpl take its effect?

Re: [racket-users] Are Regular Expression classes Unicode aware?

2020-07-09 Thread Philip McGrath
On Thu, Jul 9, 2020 at 10:32 AM Sorawee Porncharoenwase < sorawee.pw...@gmail.com> wrote: > Racket REPL doesn’t handle unicode well. If you try (regexp-match? > #px"^[a-zA-Z]+$" "héllo") in DrRacket, or write it as a program in a file > and run it, you will find that it does evaluate to #f. > See

Re: [racket-users] Are Regular Expression classes Unicode aware?

2020-07-09 Thread Ryan Culpepper
If you want a regular expression that does match the example string, you can use the \p{property} notation. For example: > (regexp-match? #px"^\\p{L}+$" "h\uFFC3\uFFA9llo") #t The "Regexp Syntax" docs have a grammar for regular expressions with links to examples. Ryan On Thu, Jul 9, 2020 a

Re: [racket-users] Are Regular Expression classes Unicode aware?

2020-07-09 Thread Sorawee Porncharoenwase
Racket REPL doesn’t handle unicode well. If you try (regexp-match? #px"^[a-zA-Z]+$" "héllo") in DrRacket, or write it as a program in a file and run it, you will find that it does evaluate to #f. On Thu, Jul 9, 2020 at 7:19 AM Peter W A Wood wrote: > I was experimenting with regular expressions

[racket-users] Are Regular Expression classes Unicode aware?

2020-07-09 Thread Peter W A Wood
I was experimenting with regular expressions to try to emulate the Python isalpha() String method. Using a simple [a-zA-Z] character class worked for the English alphabet (ASCII characters): > (regexp-match? #px"^[a-zA-Z]+$" "hello") #t > (regexp-match? #px"^[a-zA-Z]+$" "h1llo") #f It then daw