I’m trying to extract the CMS Tikiwiki version, but I have a problem extracting the version.
I’m able to extract only the first part of the number, example:
Version 15.0, I can extract only 15, but I want to extract 15.0.
if ($res=~ m/as of version (.+?)\./) {
$version = $1;
}
Sentences to extract version
The following list attempts to gather the copyright holders for Tiki as of version 15.0.
>Solution :
Try this,
if ($res =~ m/as of version (\d+(?:\.\d+))\./) {
If this is the end of the string you may want,
if ($res =~ m/as of version (\d+(?:\.\d+))\.$/) {
The pattern (\d+(?:\.\d+)) captures any digit followed by an optional grouping of . and one or more digits.