<?php
$regex = '/\d(\.\d{1,2})+/';
$inputs = [
'1.1',
'1.11',
'1.11.1'
];
foreach( $inputs as $input ) {
$matches = [];
preg_match( $regex, $input, $matches );
var_dump( $matches );
}
<?php
$regex = '/\d(\.\d{1,2})+/';
$inputs = [
'1.1',
'1.11',
'1.11.1'
];
foreach( $inputs as $input ) {
$matches = [];
preg_match( $regex, $input, $matches );
var_dump( $matches );
}