while(<>){ # method 1 : extract first version-like looking number # if string 'version' is found somehwere /version/i and /(\d+\.\d+(?:\.\d+)?)/ and $_ = "$1\n"; # method 2 : extract first version-like number after # the string 'version' /version.+(\d+\.\d+(?:\.\d+)?)/i and $_ = "$1\n"; } continue { print }
The basic idea is not to replace "everything else" but to grab what you need throw away the rest.
--In reply to Re: Version history dilemma
by fruiture
in thread Version history dilemma
by hewarn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |