in reply to regex needed
as it will split into 3 parts, throwing away the first (leading) and third (rest) parts. Compare:(undef, my $foo) = split /:/;
will split into as many parts as there are columns. So will$foo = (split/:/)[1];
@data = split/:/; $foo = $data[1];
Do you insist on a regex? I don't know if anybody gave you one already, as everybody seems to be focussing on split... Here is one:
Note that your requirement makes this easy... making me feel like this is homework. If you wanted another column, like the fourth one, the regex would look really messy.($foo) = /:(.*?):/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: regex needed
by tall_man (Parson) on Mar 14, 2003 at 19:11 UTC | |
by bart (Canon) on Mar 14, 2003 at 20:15 UTC |