diff options
| author | ptmcg <ptmcg@austin.rr.com> | 2018-10-27 12:21:59 -0500 |
|---|---|---|
| committer | ptmcg <ptmcg@austin.rr.com> | 2018-10-27 12:21:59 -0500 |
| commit | cd761d30e64c1ecaf3518087efe2f96df052c4fc (patch) | |
| tree | fe2ab5e5b3942ab47af11825f680da5347663fcd /examples/greetingInKorean.py | |
| parent | ddd2ee7e9fcf5e5b7de6f1672d32ce8e5f94348d (diff) | |
| download | pyparsing-git-cd761d30e64c1ecaf3518087efe2f96df052c4fc.tar.gz | |
Add unicode character ranges by name
Diffstat (limited to 'examples/greetingInKorean.py')
| -rw-r--r-- | examples/greetingInKorean.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/greetingInKorean.py b/examples/greetingInKorean.py index e48cc8b..2e9d4a1 100644 --- a/examples/greetingInKorean.py +++ b/examples/greetingInKorean.py @@ -6,17 +6,16 @@ #
# Copyright 2004-2016, by Paul McGuire
#
-from pyparsing import Word, srange
+from pyparsing import Word, pyparsing_unicode
-koreanChars = srange(r"[\0xac00-\0xd7a3]")
-koreanWord = Word(koreanChars,min=2)
+koreanChars = pyparsing_unicode.Korean.alphas
+koreanWord = Word(koreanChars, min=2)
# define grammar
greet = koreanWord + "," + koreanWord + "!"
# input string
-hello = '\uc548\ub155, \uc5ec\ub7ec\ubd84!' #"Hello, World!" in Korean
+hello = '안녕, 여러분!' #"Hello, World!" in Korean
# parse input string
-print(greet.parseString( hello ))
-
+print(greet.parseString(hello))
|
