"^[1-9]*[1-9][0-9]*$" 整数
"^(-?[0-9]+)(\\.[0-9]+)?$" 浮点数
"((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})(\\.((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})){3}" IP地址
"(?!0|1|2|3|4|5|6|7|8|9)^.*$" 不以数字开头的字符串
//Qt 工程使用实例
QRegExp regExp("^[1-9]*[1-9][0-9]*$");
QRegExpValidator *pattern = new QRegExpValidator(regExp, this);
ui->lineEdit_port->setValidator(pattern);