I'm afraid things are becoming more confusing rather than less. From the first four examples in your desired output I can guess at these rules:
Look for a sequence of two or more zeros
If the sequence found starts in position 1, 2 or 3, (counting from 1 but note that Perl usually counts from 0), replace all the zeros by nothing
If the sequence starts from position 4 or greater, replace all but one of the zeros with nothing
I can't see how the fifth example fits into anything you have described. Cheers, JohnGG |