Need Perl regex which matches every a software version starting from 3.10.1.0 and all further versions numbering
Don't use a regex pattern for this.
use version qw( );
if ($version >= version->declare("3.10.1.0")) {
...
} else {
...
}
This regex should do what you want.
^(?:[4-9]|[1-9]\d+)(?:\.\d+){3}|3\.[2-9]\d(?:\.\d+){2}|3\.1[1-9](?:\.\d+){2}|3\.10\.[1-9]\d?\.\d+$
It looks for all the cases where cmd_2
should run i.e.
[1-9]x.x.x.x
[4-9].x.x.x
3.[2-9]x.x.x
3.1[1-9].x.x
3.10.[1-9]x.x
3.10.[1-9].x
Demo on regex101