Hair schreef: > Hello, I have a pattern matching question, that I can't seem to find > the answer to either online or in books, so here is the pattern I am > trying to match, and hopefully some kind soul will give me pointers: > > > The satchel contains the following items (97): item1, item2, etc etc > > > I can match the first part, but I am trying to extract the item list. > I am having problems getting the pattern to match the (97) [note, > that number varies] and the : and just give me the items in the list. > > Yes, this is for a mud, but using perl regex in tinyfugue. I had > help on the tf list getting the majority of this working, but the > (97): still gets added to my list and I don't want it. TIA for any > help.
You're problem might be that you use the () unescaped. #!/usr/bin/perl use strict ; use warnings ; $\ = $, = $" = "\n" ; # see perldoc perlvar $_ = 'The satchel contains the following items (97): item1, item2, etc' ; my $re = qr/^.*?\((\d+)\):\s*(.*)/ ; my ($count, $csv) = /$re/ ; if ($count) { print $count, $csv ; @_ = split /,[[:blank:]]*/, $csv ; print '', scalar @_, @_ ; } -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>