Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IP address mask using TextInput

I am trying to create a TextInput for IP addresses, and I need to control the ranges (0-255).

I used the regExp validator, and also an inputMask of "000.000.000.000;0" but this canceled the validator.

How can I create an IP validator with an input mask?

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"
}
like image 380
user1335880 Avatar asked Nov 13 '22 07:11

user1335880


1 Answers

Skip the input mask.

And you should define different components for both IPv4 and IPv6.

like image 77
Th. Thielemann Avatar answered Dec 20 '22 23:12

Th. Thielemann