From kde-i18n-doc Thu Oct 21 01:15:28 2010 From: "Frank Weng \(a.k.a. Franklin\)" Date: Thu, 21 Oct 2010 01:15:28 +0000 To: kde-i18n-doc Subject: Re: More questions about translating kajongg Message-Id: <201010210915.30872.franklin () goodhorse ! idv ! tw> X-MARC-Message: https://marc.info/?l=kde-i18n-doc&m=128762389629461 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart1385472.3NckS0viRk" --nextPart1385472.3NckS0viRk Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Thanks for your reply. Now I'd like to discuss something about regular=20 expressions. :p =E5=9C=A8 =E9=80=B1=E4=B8=89 20 =E5=8D=81=E6=9C=88 2010 21:27:41=EF=BC=8CWo= lfgang Rohdewald =E5=AF=AB=E9=81=93: > On Mittwoch 20 Oktober 2010, Frank Weng (a.k.a. Franklin) wrote: > > Here are some more questions about translating kajongg. > > I researched the regular expressions for the rules, but > > couldn't understand some of them. > >=20 > > 1. Fourfold Plenty: > > Its regular expression > > is: /((.\d\d\d){0,1}(.4\d\d)(.\d\d\d){0,1}){4,4} - - What > > does "\d" mean? > >=20 > > - I don't understand it. Can you please give me an example > >=20 > > of that? >=20 > the english Kajongg documentation gives you a link: > http://docs.python.org/library/re.html#regular-expression-syntax > please search for \d on that page. >=20 According to this link: http://www.dragonkong.com/classic-chinese-mahjong-hands.html =46ourfold Plenty means Four Kongs. Is that true? If yes, then according to the python regexp syntax page you provided,=20 \d means [0-9], and hence (.\d\d\d){0,1} means "any char, plus three digits, the whole group repeats 0 or 1 time". Is tha= t=20 correct? I don't understand how it is related to four kongs. Also, what does "(.4\d\d)" mean? * * * Another question is about "Winding Snake". Here is the code of predefined.= py=20 in trunk: self.winnerRules.append(Rule('Winding Snake', r'I^(([sbc])1\2[1]\2[1] \2[2]\2[2]=20 \2[3]\2[4]\2[5]\2[6]\2[7]\2[8] \2[9]\2[9]\2[9] [fy/])' \ r'|^(([sbc])1\4[1]\4[1] \4[2]\4[3]\4[4]=20 \4[5]\4[5]\4[6]\4[7]\4[8] \4[9]\4[9]\4[9] [fy/])' \ r'|^(([sbc])1\6[1]\6[1] \6[2]\6[3]\6[4]=20 \6[5]\6[6]\6[7]\6[8]\6[8] \6[9]\6[9]\6[9] [fy/])', limits=3D1, description=3Dm18n('All tiles of same color. Pung or Kong = of 1=20 and 9, pair of 2, 5 or 8 and two ' 'Chows of the remaining values'))) I don't understand what "1\2[1]\2[1] \2" mean. According to the python reg= exp=20 syntax page, "\number" means "Matches the contents of the group of the same= =20 number. Groups are numbered starting from 1. For example, (.+) \1 matches '= the=20 the' or '55 55', but not 'the end' (note the space after the group). " But= I=20 can't explain the above regexp. \4, \6 means to match the contents of the= =20 group four and six more times? Also, the description of it, "All tiles of same color. Pung or Kong of 1 a= nd=20 9, pare of 2,5,8 and two chows of the remaining values". I can't match it= =20 with the regexp, also I can't understand the tiles: 111225588999 then two more chows? In the page I provided there is a "The Wriggling Snake" but it is totally=20 different then the "Winding Snake" here. Could you please explain it more? Thanks, =46ranklin --nextPart1385472.3NckS0viRk Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEABECAAYFAky/lDEACgkQ2tS+js/1yxa7hQCfeAgbRsL5yIqqeks96eUP8z3f vUYAnRmzJF7kBCIhHBkJWy/KAkvUj147 =VTSY -----END PGP SIGNATURE----- --nextPart1385472.3NckS0viRk--