---------- Forwarded Message ----------
From: Damian Conway <[EMAIL PROTECTED]>
Subject: Re: Matching Roman numerals (fwd)

Can someone come up with a (nice) regex that matches only Roman
numerals?

I'm trying to include proper case conversion to title case in a script,
and it should turn a movie title like "HALLOWEEN II" into "Halloween
II", not "Halloween Ii".

---------- End Forwarded Message ----------

Doesn't your email formatter do this out of the box?
Yep. Though only for numerals that are bullets.

The required regex is:

	/(M{0,3})(C[MD]|DC{0,3}|C{1,3}|)(X[CL]|LX{0,3}|X{1,3}|)(I[XV]|VI{0,3}|I{
1,3}|)/

or (without captures):

	/M{0,3}(?:C[MD]|DC{0,3}|C{1,3}|)(?:X[CL]|LX{0,3}|X{1,3}|)(?:I[XV]|VI{0,3
}|I{1,3}|)/


Damian
---------- End Forwarded Message ----------



--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                           +1 800 762 1582

Reply via email to