> For example, the string > > "1111 2222aa3333 444 55555555 6666 7777-8888" > > should yield > > 1111, 2222, 3333, 6666, 7777, 8888.
That's actually kind of tricky. How about: $aa = "1111 2222aa3333 444 55555555 6666 7777-8888"; @aa = $aa =~ /(?<!\d)\d{4}(?!\d)/g; print "$_\n" for @aa; That gets 2222 and 3333 also, which the \b solution skips. What it says is to get all groups of 4 numbers not following or followed by another number. Dave ps - also see perldoc -f perlre and look for zero-width negative look(ahead|behind) assertions -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>