Scott E Robinson wrote: > Hi, Rob! Amazing how quickly you coded those up! > > 1.a. works great. > > 1.b. doesn't quite work yet. The revised version (my @wanted = > $string =~ /\b\w\d*\b/ig;) seems to let everything pass through it.
Sorry, I would say I'm having a bad day, but I'm not - I have no excuse! > b. remove all but the single-character and all-numeric > substrings and leave the rest alone? my @wanted = $string =~ /\b(\w|\d+)\b/ig; print "@wanted\n"; output M 8 > 1.c. - Sorry I wasn't clear. I need to keep the all-numeric > substrings as well as keeping the single- and double-letter substrings. my $string = ':1:12:123:1234:A:AA:AAA:AAAA:A1:A11:A111:'; my @wanted = $string =~ /\b(\w\w?|\d+)\b/ig; print "@wanted\n"; output 1 12 123 1234 A AA A1 > Does the output have to go to an array? I can just reassemble it to a > single string (either delimited by colons or single blanks) as you > showed, but wondered if it can be skipped for greater efficiency. It has to go /via/ a list, but you can do it in one step without using an array like this: my $string = ':B520:L201:M:M260:8:G607:'; my $subset = join ':', '', $string =~ /\b(\w\w?|\d+)\b/ig, ''; print $subset; output :M:8: Is that any better? :-) Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]