laziness, impatience, and hubris | |
PerlMonks |
Re: Help with a Regexby Animator (Hermit) |
on May 06, 2005 at 12:46 UTC ( [id://454660]=note: print w/replies, xml ) | Need Help?? |
I believe that this code does what you want. First it creates a string of 7 dots, then it will look for each letter, if it finds it, it sets all charachters after it (in the output string) to dots, and removes all occurence of that charachter from the input string.
Note, this code is similar to tlm's code, except that his code does not reset the dots, which is what the OP wants... (or atleast I guess that's what he wants by looking at the desired output) Update: typo + note about tlm's code Update2: code has a bug... input: 'XL', 'XC' and 'CDXLVI' do not generate the correct output... Update3: I fail to see the consintency in the OP's desired output. XL, and XC should result in X, which would mean that any charachter following X (other then V and I) should be ignored, but CDXLVI should result in .D..XVI, meaning that the C is ignored... this makes no sense to me.
In Section
Seekers of Perl Wisdom
|
|