If you wanted to shorten up the regex, you could do something like this:
my $str = "R4:abcxyz45:LNX"; my ($servername) = ($str =~ /:(.+):/);
However, I should point out that this has a greater potential to create problems than the regexes offered by kennethk. In other words, the above has shorter keystrokes, but kennethk's solutions are safer.
In reply to Re: Regexp help
by dasgar
in thread Regexp help
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |