I think this might work. /\b\d{4}\b/
Rob -----Original Message----- From: Chap Harrison [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 10:38 AM To: [EMAIL PROTECTED] Subject: Trouble with m///g Hi, I'm trying to extract all four-digit numbers from a string in one fell swoop, but I can't seem to come up with the proper regexp. This is my first time using /g in a match so maybe there's a trick I'm missing. For example, the string "1111 2222aa3333 444 55555555 6666 7777-8888" should yield 1111, 2222, 3333, 6666, 7777, 8888. Here's one attempt that I thought had a reasonable chance. - - - - - #!/usr/bin/perl -w my $foo = "1111 2222aa3333 444 55555555 6666 7777-8888"; my @a = ($foo =~ m'[\D^](\d{4})[\D$]'g); print "<$foo>\n"; print(join(":",@a)."\n"); - - - - - <1111 2222aa3333 444 55555555 6666 7777-8888> 2222:3333:6666 Thanks for your consideration, Chap -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>