my $test = ";Town ; London;"; if ($test =~ /Town ;([^;]+);/) { print $1; # $1 contains 'London ' }