^((([2][5][0-5]|([2][0-4]|[1][0-9]|[0-9])?[0-9])\\.){3})([2][5][0-5]|([2][0-4]|[1][0-9]|[0-9])?[0-9])$
C++ (Qt)QRegExp regExp("^((([2][5][0-5]|([2][0-4]|[1][0-9]|[0-9])?[0-9])\\.){3})([2][5][0-5]|([2][0-4]|[1][0-9]|[0-9])?[0-9])$");ui_connect_server_ibsu->ip_address_server_ibsu->setValidator(new QRegExpValidator(regExp,this));
C++ (Qt)ui->lineEdit_IP->setInputMask( "000.000.000.000" ); QHostAddress myIP; if( myIP.setAddress( ui->lineEdit_IP->text()) ) qDebug()<<"Valid IP Address"; else qDebug()<<"Invalid IP address";