You will want to use chomp, not chop. Then you can put all your codes within a while loop more constructively.
In reply to Re: Reg Ex exercise by 2teez in thread Reg Ex exercise by keesturam