regular expression
问题 How do I write a regular expression to get that returns only the letters and numbers without the asterisks in between ? 回答1: You could use a regex replacement here: my $var = 'RMRIV43069411**2115.82'; $var =~ s/^.*?\D(\d+(?:\.\d+)*)$/$1/g; print "$var"; // 2115.82 The idea is to capture the final number in the string, and then replace with only that captured quantity. Here is an explanation of the pattern: ^ from the start of the input .*? consume all content up until \D the first non digit