Regex 使用TextInput的IP地址掩码
我正在尝试为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:/^(
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似乎一切正常。对,我只是使用了他/她的正则表达式,没有输入掩码。。。工作正常=)