Assigns everything up to the first comma to $first
Up to the last comma, actually. If you want "up to the first comma" either use ([^,]*), or (.*?),$ perl -wle 'my $str = "a, b,"; my ($first) = $str =~ /(.*),/; print $ +first' a, b
In reply to Re^2: Regex to take an ip address before a comma
by moritz
in thread Regex to take an ip address before a comma
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |