in reply to Re: Regex question
in thread Regex question

So much of your code can be simplified by changing
while ($str =~ /([A-Z,0-9])/ig) {
to
while ($str =~ /(([A-Z,0-9])\2*)/ig) {

The posted code is beyond not elegant. It's in the realm of needless complexity.

Update: Forgot to mention:

Besides that, I don't know why you imposed a limit on which characters can be processed. The OP didn't mention anything about ignoring characters which are neither unaccented latin alpha, romanlatin? digits nor a comma. (Did you even mean to put that comma there?)

Replies are listed 'Best First'.
Re^3: Regex question
by ww (Archbishop) on May 20, 2009 at 20:29 UTC

    1. Stuck to the char set provided by OP. (BTW, I think that while the "I," "V," "X," "L," "C," "and "M" fill the bill as "Roman numerals," "0" .. "9" are Arabic.)

    2. No. Dumb mistake!