Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 使用TextInput的IP地址掩码_Regex_Qt_Validation_Ip_Qml - Fatal编程技术网

Regex 使用TextInput的IP地址掩码

Regex 使用TextInput的IP地址掩码,regex,qt,validation,ip,qml,Regex,Qt,Validation,Ip,Qml,我正在尝试为IP地址创建一个TextInput,我需要控制范围(0-255) 我使用了regExp验证程序,还使用了“000.000.000.000;0”的inputMask,但这取消了验证程序 如何使用输入掩码创建IP验证程序 TextInput { id: myLineEdit anchors.fill: parent cursorVisible: true focus: true validator:RegExpValidator { regExp:/^(

我正在尝试为IP地址创建一个
TextInput
,我需要控制范围(
0-255

我使用了
regExp
验证程序,还使用了
“000.000.000.000;0”
inputMask
,但这取消了验证程序

如何使用输入掩码创建IP验证程序

TextInput
{
  id: myLineEdit
  anchors.fill: parent
  cursorVisible: true
  focus: true

  validator:RegExpValidator
  {
    regExp:/^(([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))\.){3}([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))$/
  }

  inputMask:  "000.000.000.000;0"
}
跳过输入掩码


您应该为IPv4和IPv6定义不同的组件。

我尝试了您的代码,QtQuick 1.1似乎一切正常。对,我只是使用了他/她的正则表达式,没有输入掩码。。。工作正常=)