[Nvda-dev] commit r1954 - in trunk: . source
Lubos Pintes
lubos.pintes at orangemail.sk
Fri Apr 25 10:08:56 UTC 2008
Ok, here, regex for roman numerals:
>>> pattern = """
^ # beginning of string
M{0,4} # thousands - 0 to 4 M's
(CM|CD|D?C{0,3}) # hundreds - 900 (CM), 400 (CD), 0-300 (0 to 3
C's),
# or 500-800 (D, followed by 0 to 3 C's)
(XC|XL|L?X{0,3}) # tens - 90 (XC), 40 (XL), 0-30 (0 to 3 X's),
# or 50-80 (L, followed by 0 to 3 X's)
(IX|IV|V?I{0,3}) # ones - 9 (IX), 4 (IV), 0-3 (0 to 3 I's),
# or 5-8 (V, followed by 0 to 3 I's)
$ # end of string
"""
James Teh wrote / napísal(a):
> Lubos Pintes wrote:
>> Perhaps it would be better to write this regex as shown in "Dive into
>> python". Now it is really terrible :-).
> Explain.
>
> Jamie
>
More information about the Nvda-dev
mailing list